Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
referer mod
You don't have permission for this action!
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2021-03-03 16:53:58
Is this what you are looking for? botanicar
if ($action == "referer")
{
         $count = get_row_count("referer");
       
         list ($pagertop, $pagerbottom, $limit) = pager(20, $count, 'admincp.php?action=referer&');
       
         $res = SQL_Query_exec("SELECT * FROM `referer` ORDER BY `added` DESC $limit");
       
         stdhead("Site Referer");
         
       
         begin_frame("Site Referer");
       
         if ( mysqli_num_rows($res) > 0 )
         {
                  ?>
                  <table class="table_table" cellpadding="3" cellspacing="3" width="75%" align="center">
                  <tr>
                          <th class="table_head">Referer</th>
                          <th class="table_head">Added</th>
                          <th class="table_head">Count</th>
                  </tr>
                  <?php while ($row = mysqli_fetch_assoc($res)): ?>
                  <tr>
                          <td class="table_col1"><a href="<?php echo $row['referer']; ?>"><?php echo $row['referer']; ?></a></td>
                          <td class="table_col2"><?php echo date('F d, Y g:i a',$row['added']); ?></td>
                          <td class="table_col1"><?php echo number_format($row['count']); ?></td>
                  </tr>
                  <?php endwhile; ?>
                  </table>
                  <?php
                 
                  if ( $count > 20 ) echo $pagerbottom;
         }
         else
         {
                  echo('<center><b>No Referrals Found...</b></center>');
         }
       
         end_frame();
 navmenu();
         stdfoot();
}

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2021-03-04 08:54:25
Hi and thanks man, I have identical script part as yours but it does not seem to work in any way.


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2021-03-04 16:56:15
hmm, I never paid any attention to it. Do you have the sql for it also?
CREATE TABLE `referer` (
 `referer` varchar(255) NOT NULL DEFAULT '',
 `added` int(11) NOT NULL DEFAULT 10,
 `count` int(10) unsigned NOT NULL DEFAULT 0,
 UNIQUE KEY `referer` (`referer`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-03-04 17:00:07
2021-03-04 22:48:17
Yes mate and it is empty :(


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2021-03-04 23:37:03
It should get the info from $_SERVER['HTTP_REFERER'] . If people are using the front door to your page and not linking from elsewhere, it can be blank. this is in index.php. if you dont have this, place near the top outside of any other functions
if (isset($_SERVER['HTTP_REFERER']))
{
  $parse = parse_url($_SERVER['HTTP_REFERER']);
               
  if ($parse['host'] != $_SERVER['HTTP_HOST'])
          SQL_Query_exec("INSERT INTO `referer` (`referer`, `added`, `count`) VALUES ('".$parse['scheme'] . '://' . $parse['host']."', '".gmtime()."', '1') ON DUPLICATE KEY UPDATE `count` = `count` + 1");
}

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-03-04 23:44:45
2021-03-05 10:42:28
// REFERES SITES
if ( isset( $_SERVER['HTTP_REFERER'] ) )
{
$parse = parse_url($_SERVER['HTTP_REFERER']);
             
if ($parse['host'] != $_SERVER['HTTP_HOST'])
SQL_Query_exec("INSERT INTO 'referer' ('referer', 'added', 'count') VALUES ('".$parse['scheme'] . '://' . $parse['host']."', '".gmtime()."', '1') ON DUPLICATE KEY UPDATE 'count' = 'count' + 1");
}
// END!


Seems too be a same code, but don't work
no mather mate, that won't work and we archive that

Thanks for help


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2021-03-05 21:52:28
If you removed isset() you would take note of the warnings, and what the problem is.

isset() is faster than array_key_exists, however returns/handles checks differently.

Both are good to use in this case:

if (isset($_SERVER['HTTP_REFERER']) || array_key_exists('HTTP_REFERER', $_SERVER))

Anyway, try this:


error_reporting(E_ALL);
if (isset($_SERVER['HTTP_REFERER'])) {
   $parse = parse_url($_SERVER['HTTP_REFERER']);
   if ($parse['host'] != $_SERVER['HTTP_HOST']) {
       echo 'No referer';
   } else {
       SQL_Query_exec("INSERT INTO 'referer' ('referer', 'added', 'count') VALUES ('" . $parse['scheme'] . '://' . $parse['host'] . "', '" . gmtime() . "', '1') ON DUPLICATE KEY UPDATE 'count' = 'count' + 1");
   }
}



2021-03-06 12:56:05
Thanks @STorrents2020 i try it, but on some way that not work too,
it make me crazy ....
it works on my old vps and OS but not now

Centos 7
Apache version: Apache/2.4.39
PHP version: 7.4.13 (5.6.40 on curent page)
MySQL version: 10.2.37-MariaDB
Web Servers: nginx-varnish-apache

regards guys

Sometime comming that error message:

Database Error in index.php on line 16: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''referer' ('referer', 'added', 'count') VALUES ('https://example.com', '1615...' at line 1. Query was: INSERT INTO 'referer' ('referer', 'added', 'count') VALUES ('https://example.com', '1615035891', '1') ON DUPLICATE KEY UPDATE 'count' = 'count' + 1.



www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
Last edited by Botanicar on 2021-03-06 13:09:18
2021-03-06 20:50:55
just a thought, but replace your line with this one exactly. just copy and paste it. I think you are using an apostrophy rather than back quotes. Just a thought
SQL_Query_exec("INSERT INTO `referer` (`referer`, `added`, `count`) VALUES ('".$parse['scheme'] . '://' . $parse['host']."', '".gmtime()."', '1') ON DUPLICATE KEY UPDATE `count` = `count` + 1");

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-03-07 04:25:21
2025-03-05 00:35:05
I updated this a little bit. Here ya go. I wanted a delete button
if ($action == "referer")
{
   if (isset($_POST['delete'])) {
       $referer = mysqli_real_escape_string($GLOBALS['DBconnector'], $_POST['delete']);
       SQL_Query_exec("DELETE FROM `referer` WHERE `referer` = '$referer'");
       autolink("admincp.php?action=referer", "<b><font color='#ff0000'>Referers Deleted</font></b>");
   }

   $count = get_row_count("referer");
   
   list ($pagertop, $pagerbottom, $limit) = pager(20, $count, 'admincp.php?action=referer&');
   
   $res = SQL_Query_exec("SELECT * FROM `referer` ORDER BY `added` DESC $limit");
   
   stdhead("Site Referer");
   
   begin_frame("Site Referer");
   
   if (mysqli_num_rows($res) > 0)
   {
       ?>
       <table class="table_table" cellpadding="3" cellspacing="3" width="75%" align="center">
       <tr>
           <th class="table_head">Referer</th>
           <th class="table_head">Added</th>
           <th class="table_head">Count</th>
           <th class="table_head">Action</th>
       </tr>
       <?php while ($row = mysqli_fetch_assoc($res)): ?>
       <tr>
           <td class="table_col1"><a href="<?php echo $row['referer']; ?>"><?php echo $row['referer']; ?></a></td>
           <td class="table_col2"><?php echo date('F d, Y g:i a', $row['added']); ?></td>
           <td class="table_col1"><?php echo number_format($row['count']); ?></td>
           <td class="table_col2" style="text-align: center;">
               <form method="post" action="admincp.php?action=referer"
                     onsubmit="return confirm('Are you sure you want to delete this referer?')"
                     style="display: inline;">
                   <input type="hidden" name="delete" value="<?php echo htmlspecialchars($row['referer']); ?>">
                   <input type="submit" value="Delete">
               </form>
           </td>
       </tr>
       <?php endwhile; ?>
       </table>
       <?php
       if ($count > 20) echo $pagerbottom;
   }
   else
   {
       echo('<center><b>No Referrals Found...</b></center>');
   }
   
   end_frame();
   navmenu();
   stdfoot();
}

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728