Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   Mods & Themes (http://www.bvlist.com/forumdisplay.php?f=109)
-   -   simple referer (http://www.bvlist.com/showthread.php?t=1745)

hellix 5th January 2009 19:44

simple referer
 
sql
PHP Code:

CREATE TABLE `referer` (
  `
idbigint(99NOT NULL auto_increment,
  `
urlvarchar(255NOT NULL default '',
  `
ipvarchar(255NOT NULL default '',
  `
datetimestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  
PRIMARY KEY  (`id`)
ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=61 

add in bitorrent or functions.php

PHP Code:

function referer() {
   global 
$domain;
    
$refer  $_SERVER['HTTP_REFERER'];
    
$ip $_SERVER['REMOTE_ADDR'];
    if ((
$refer) and (!strstr($refer$domain))) {
      
$sql "INSERT INTO referer (url,ip) VALUES ('$refer','$ip')";
       
$result mysql_query($sql);

    }



next create new file referer.php

PHP Code:

<?php
//Referer based on site log by norris  modified by hellix
require "include/functions.php";
dbconn(false);
loggedinorreturn();
parked();

stdhead();
if (
get_user_class() < UC_ADMINISTRATOR)
stderr("Error""Permission denied.");
$secs 1*86400;
mysql_query("DELETE FROM referer WHERE " gmtime() . " - UNIX_TIMESTAMP(date) > $secs") or sqlerr(__FILE____LINE__);
$res mysql_query("SELECT COUNT(*) FROM referer");
$row mysql_fetch_array($res);
$count $row[0];
$pg 30;
list(
$pagertop$pagerbottom$limit) = pager(20$count"referer.php?");
$res mysql_query("SELECT date, url,ip FROM referer ORDER BY date DESC $limit") or sqlerr(__FILE____LINE__);
  if (
mysql_num_rows($res) == 0)
    echo(
"<b>Referer is empty</b>\n");
  else
  {
echo 
$pagertop;
 echo(
"<table border=1 cellspacing=0 width=95% cellpadding=5>\n");
  echo(
"<tr><td class=tabletitle align=left><b>Date</b></td><td class=tabletitle align=left><b>Time</b></td><td class=tabletitle align=left><b>Url</b></td><td class=tabletitle align=left><b>Ip</b></td></tr>\n");
 while (
$arr mysql_fetch_assoc($res))
 {
$color '#6699FF';
   
$date substr($arr['date'], 0strpos($arr['date'], " "));
   
$time substr($arr['date'], strpos($arr['date'], " ") + 1);
   echo(
"<tr class=tableb><td style=background-color:$color><font color=black>$date</td><td style=background-color:$color><font color=black>$time</td><td style=background-color:$color align=left><font color=black>".htmlspecialchars($arr['url'])."</font><td style=background-color:$color align=left><font color=black>".htmlspecialchars($arr['ip'])."</font></font></font></td></tr>\n");
 }
 echo(
"</table>");
}
echo 
$pagerbottom;
echo(
"<p>Times are in GMT.</p>\n");
stdfoot();

?>

nex add referer(); it where is necessary to you :nosepick:

DeCoder 12th January 2009 01:38

i dont get this one ....where is it good for?

hellix 16th January 2009 23:31

new

PHP Code:

<?php
//Referer based on site log by norris  modified by hellix
require "include/functions.php";
dbconn(false);
loggedinorreturn();
parked();


if (
get_user_class() < UC_ADMINISTRATOR)
stderr("Error""Permission denied.");
if (
$_SERVER["REQUEST_METHOD"] == "POST")
{
if (
$_POST["delete"])
mysql_query("DELETE FROM referer");
header("Location: $BASEURL/referer.php");
die;
}
stdhead();
$secs 1*86400;
mysql_query("DELETE FROM referer WHERE " gmtime() . " - UNIX_TIMESTAMP(date) > $secs") or sqlerr(__FILE____LINE__);
$res mysql_query("SELECT COUNT(*) FROM referer");
$row mysql_fetch_array($res);
$count $row[0];
$pg 30;
list(
$pagertop$pagerbottom$limit) = pager(20$count"referer.php?");
$res mysql_query("SELECT date, url,ip FROM referer ORDER BY date DESC $limit") or sqlerr(__FILE____LINE__);
  if (
mysql_num_rows($res) == 0)
    echo(
"<b>Referer is empty</b>\n");
  else
  {
echo 
$pagertop;
 echo(
"<table border=1 cellspacing=0 width=95% cellpadding=5>\n");
  echo(
"<tr><td class=tabletitle align=left><b>Date</b></td><td class=tabletitle align=left><b>Time</b></td><td class=tabletitle align=left><b>Url</b></td><td class=tabletitle align=left><b>Ip</b></td></tr>\n");
 while (
$arr mysql_fetch_assoc($res))
 {
   
$date substr($arr['date'], 0strpos($arr['date'], " "));
   
$time substr($arr['date'], strpos($arr['date'], " ") + 1);
   echo(
"<tr class=tableb><td><font color=black>$date</td><td><font color=black>$time</td><td align=left><font color=black>".htmlspecialchars($arr['url'])."</font><td align=left><font color=black>".htmlspecialchars($arr['ip'])."</font></font></font></td></tr>\n");
 }
 echo(
"</table><p></p>");
  echo(
"<form method=post action=referer.php><tr><td colspan=2 align=center><input type=submit name='delete' class='groovybutton' value='Delete'></td></tr>");
}

echo 
$pagerbottom;
echo(
"<p>Times are in GMT.</p>\n");
stdfoot();

?>


ajax 3rd February 2010 20:12

What is this? :lol:


All times are GMT +2. The time now is 14:49.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.