Файл: www/show.php
Строк: 51
<?
session_start();
include "admin/config/config.php";
include "admin/config/secur.php";
$ids = (int) $_GET['i'];
if (isset($_SESSION['TIME']))
{
if ($_SESSION['TIME']>time())
{
$_SESSION=array();
}
}
if (isset($_SESSION['SURL']))
{
$URL=$_SESSION['SURL'];
if ($_SESSION['TIME']<time())
{
$_SESSION['TIME']=time()+($SEC-1);
}
}
if (!isset($_SESSION['SURL']))
{
$res = mysql_query("SELECT types FROM `reqlinks` WHERE id='$ids' limit 1");
$cr=mysql_fetch_assoc($res);
$ST = $cr['types'];
$res = mysql_query("SELECT url,id,domen FROM links where type='$ST' order by rid limit 1");
if(mysql_num_rows($res)>0)
{
$cr=mysql_fetch_assoc($res);
$URL=$cr['url'];
$id=$cr['id'];
$domen=$cr['domen'];
/////////////////////////////////////
$res2 = mysql_query("SELECT * FROM stats where domen='".$domen."'");
if(mysql_num_rows($res2)>0)
{
mysql_query("UPDATE stats set visits=visits+'1' where domen='".$domen."'");
$cr=mysql_fetch_assoc($res2);
$vis=$cr['visits']+1;
mysql_query("UPDATE links set visits='$vis' where domen='".$domen."'");
}
if(mysql_num_rows($res2)==0)
{
mysql_query("INSERT INTO `stats` (`id` ,`domen` ,`visits`)
VALUES (NULL , '$domen', '1');");
}
//////////////////////////////////////
$_SESSION['larray']=array();
$_SESSION['larray'][$id]=1;
}
if(mysql_num_rows($res)==0)
{
$res = mysql_query("SELECT url,domen,types FROM reqlinks where id='$ids'");
$cr=mysql_fetch_assoc($res);
$url = $cr['url'];
$domen = $cr['domen'];
$type = $cr['types'];
mysql_query("INSERT INTO `links` (`id` ,`url` ,`domen` ,`type`)
VALUES (NULL , '$url', '$domen', '$type');");
$_SESSION=array();
header("Location: index.php?e=$ids");
exit;
}
}
$_SESSION['TURL']=$URL;
mysql_close();
?>
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<title><?=$sitename?> - Привлечение посетителей, обмен посещениями</title>
<frameset rows="80,*">
<frame marginwidth="0" marginheight="0" name="frminfo" scrolling="no" noresize src="views.php?i=<?=$ids?>">
<frame name="frmus" id="frmus" src="<?=$URL?>">
</frameset>
</head>
</html>