Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev > Mods & Themes
Reply
  #1  
Old 5th January 2009, 19:44
hellix's Avatar
hellix hellix is offline
Senior Member
 
Join Date: Oct 2008
Lithuania
Posts: 20
Cool 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:
Reply With Quote
The Following 2 Users Say Thank You to hellix For This Useful Post:
Moh.ElBaz (28th February 2009), Tibys08 (29th May 2011)
  #2  
Old 12th January 2009, 01:38
DeCoder DeCoder is offline
Member
 
Join Date: Feb 2008
Posts: 10
Default
i dont get this one ....where is it good for?
Reply With Quote
  #3  
Old 16th January 2009, 23:31
hellix's Avatar
hellix hellix is offline
Senior Member
 
Join Date: Oct 2008
Lithuania
Posts: 20
Default
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();

?>

Last edited by hellix; 17th January 2009 at 05:20.
Reply With Quote
The Following User Says Thank You to hellix For This Useful Post:
Tibys08 (29th May 2011)
  #4  
Old 3rd February 2010, 20:12
ajax's Avatar
ajax ajax is offline
Senior Member
 
Join Date: Apr 2009
United Kingdom
Posts: 165
Default
What is this?
Reply With Quote
The Following User Says Thank You to ajax For This Useful Post:
Daz (4th February 2010)
Reply

Tags
referer , simple

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[PMBT 2.X] Simple-Green wMan Mods & Themes 1 27th April 2012 05:34
simple questions but Im lost kayser757 Community Cafe 3 3rd March 2010 03:58
[PMBT 2.X] Simple-Violet wMan Mods & Themes 0 11th February 2010 14:51
[PMBT 2.X] Simple-Blue wMan Mods & Themes 0 11th February 2010 14:50
Simple Invite System v1.0 Fynnon Mods & Themes 0 3rd July 2008 12:15



All times are GMT +2. The time now is 10:50. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.