<?
/* Coded By XhanDros a.k.a Yunus Emre Yılmaz | Blog : http://xhandros.net | Mail: xhandros@turkgate.com
* www.turkgate.com | www.mydesign.gen.tr
* Released under gnu/gpl.(gnu.org)| You can use this script without deleting these phrases */
// Database configuration //
$dbhost = "localhost"; // Db server/host
$dbuser = "admin"; // Db username
$dbpass = "admin"; // Db password
$dbname = "guard"; // Dbname
// Database conf. ended //
// mySQL schema //
#############
#CREATE TABLE guard (
#id smallint(6) NOT NULL auto_increment,
#ip varchar(255) NOT NULL default '0',
#info varchar(255) NOT NULL default '',
#page varchar(255) NOT NULL default '',
#date varchar(255) NOT NULL default '',
#PRIMARY KEY (id), KEY id (id) ) TYPE=MyISAM;
###############################
// Your Global Variables //
$perm = "5"; // // Page view limit
// Global vars. ended //
// mySQL connection
@mysql_connect($dbhost,$dbuser,$dbpass) or die ("Can't connect to database.Modify your configuration file");
@mysql_select_db($dbname) or die ("Can't select database name.Modify your configuration file.");
// mySQL conn. ended //
// User defined vars //
$ip = $_SERVER['REMOTE_ADDR']; // Ip Addres
$info = $_SERVER['HTTP_USER_AGENT'];
// Browser info etc.
$page_self = $_SERVER['PHP_SELF'];
$querystring = $_SERVER['QUERY_STRING'];
$page ="$page_self$querystring";
// permalink - like guard.php?process=index
$date1 = date("dmy");
// Day - Month - Year [ like 18(.)05(.)2005 ]
// User defined vars ended //
// Inserting Data to SQL table //
$iceri = mysql_query("INSERT INTO `guard` (`ip`, `info`,`page`,`date1`) VALUES ('$ip', '$info','$page','$date1')");
// Insert Ended
$query = mysql_query("SELECT * FROM guard where ip='$ip' order by id desc limit 0,1");
while($output = mysql_fetch_array($query)) { $outdate = $output['date']; }
$tk="SELECT page FROM `guard` where date1='$date1' AND ip='$ip'";
$tk1= mysql_db_query($dbname,$tk);
$total_data = mysql_num_rows($tk1);
/* If user's limit expire , shoot "him/her/?" from page ;) */
if($total_data > "$perm" AND $outdate = $date1)
die(" Your page view limit expired($perm).Please wait <b>1</b> day and continue viewing pages<br>
<div align=right><i>Protected By [YNS]Bandwith Guard v0.1</div></i>");
/* After these phrases your page will be came.For script support or any idea for developing , you may say your idea
in my blog. ( http://www.xhandros.net/ ) */
?>