File size: 1.74Kb
<?php
include_once ('config/ini.php');
//include_once ('config/header.php');
include_once ('config/connect.php');
mysql_query("DELETE FROM `link` WHERE `data` < '".date("Y-m-d H:i:s")."' and `data`<>''");
mysql_query("DELETE FROM `kol` WHERE `data` < '".date("Y-m-d H:i:s",(time()-2592000))."'");
if(!empty($_GET['mod']))
{
$mod = $_GET['mod'];
}
else
{
$mod = "";
}
switch($mod)
{
case 'go':
$id = (int) $_GET['id'];
$qw = mysql_query("SELECT * FROM `link` WHERE `id` = '".$id."';");
$go = mysql_fetch_array($qw);
$names=$go['name'];
$golink=$go['url'];
$currDate = date("Y-m-d");
$q = mysql_query("SELECT * FROM `kol` WHERE `data` = '".$currDate."' and `name` = '".$names."';");
if(mysql_affected_rows() == 0)
{
$dobav = mysql_query("INSERT INTO `kol` SET `data` = '".$currDate."', `kol` = '0', `name` ='".$names."'");
}
$sql = mysql_query("UPDATE `kol` SET `kol` = `kol`+1 WHERE `data` = '".$currDate."' and `name` = '".$names."'");
header("Location: $golink");
exit;
break;
default:
$q=mysql_query("SELECT * FROM `link` order by `pow` ASC");
while($link=mysql_fetch_array($q))
{
$bb = '';
$bb_end = '';
if($link['bb'] == 1)
{
$bb = '<b>';
$bb_end = '</b>';
}
elseif($link['bb'] == 2)
{
$bb = '<i>';
$bb_end = '</i>';
}
elseif($link['bb'] == 3)
{
$bb = '<b><i>';
$bb_end = '</i></b>';
}
if(!empty($link['color']))
{
$bb .= '<font color="'.$link['color'].'">';
$bb_end = '</font>'.$bb_end;
}
echo "<img src='http://clikus.ru/images/rek.gif' alt='*' /><a href='link/$link[id]'>$bb $link[name] $bb_end</a><br/>\n";
}
break;
}
?>