<?
$dbhost = "localhost";
$dbuser = "admin";
$dbpass = "admin";
$dbname = "guard";
$perm = "5";
@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.");
// User defined vars //
$ip = $_SERVER['REMOTE_ADDR'];
$info = $_SERVER['HTTP_USER_AGENT'];
$page_self = $_SERVER['PHP_SELF'];
$querystring = $_SERVER['QUERY_STRING'];
$page ="$page_self$querystring";
$date1 = date("dmy");
$iceri = mysql_query("INSERT INTO `guard` (`ip`, `info`,`page`,`date1`) VALUES ('$ip', '$info','$page','$date1')");
$query = mysql_query("SELECT date FROM guard where ip='$ip' order by id desc limit 0,1");
$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($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>");
?>