Файл: mod/go.php
Строк: 4
<?php
include '../db.php';
if(isset($_GET['id'])){
$ip=$_SERVER['REMOTE_ADDR'];
$go=$_GET['id'];
$data = mysql_query("SELECT * FROM `rek` WHERE `ok`>NOW() AND `id` = '".$go."' ORDER BY RAND() LIMIT 1");
while ($row = mysql_fetch_assoc($data)){
$f = mysql_fetch_assoc(mysql_query("SELECT * FROM `go` WHERE `go` = '".$go."' AND `ip` = '".$ip."'"));
if (!$f['go']){
mysql_query("UPDATE `rek` SET `go` = `go` + '1' WHERE `id` = '".$row['id']."'");
mysql_query("UPDATE `clicks` SET `go` = `go` + '1'");
mysql_query("INSERT INTO `go` SET `go` = '".$row['id']."', `ip` = '".$ip."'");
header ('location: '.$row['url'].'');
} else {
header ('location: '.$row['url'].'');
}
}
}
?>