Файл: public_html/frend_add.php
Строк: 66
<?
include_once 'sys/inc/start.php';
include_once 'sys/inc/compress.php';
include_once 'sys/inc/sess.php';
include_once 'sys/inc/home.php';
include_once 'sys/inc/settings.php';
include_once 'sys/inc/db_connect.php';
include_once 'sys/inc/ipua.php';
include_once 'sys/inc/fnc.php';
include_once 'sys/inc/user.php';
only_reg();
if (!isset($_GET['id'])){header("Location: index.php?1".SID);exit;}
$ank['id']=intval($_GET['id']);
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '$ank[id]' LIMIT 1"),0)==0){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `frends` WHERE (`user` = '$user[id]' AND `frend` = '$ank[id]') OR (`user` = '$ank[id]' AND `frend` = '$user[id]') LIMIT 1"),0)==1){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `frends_new` WHERE (`user` = '$user[id]' AND `to` = '$ank[id]') OR (`user` = '$ank[id]' AND `to` = '$user[id]') LIMIT 1"),0)==1){header("Location: index.php?".SID);exit;}
if ($ank['id']==$user['id']){header("Location: index.php?".SID);exit;}
mysql_query("INSERT INTO `frends_new` (`user`, `to`, `time`) values('$user[id]', '$ank[id]', '$time')");
$hereJob = mysql_query("SELECT id FROM jobs WHERE user = '$user[id]' AND job = '1' AND status = '1' LIMIT 1");
if (mysql_num_rows($hereJob) != false) {
$_FileJob = file_get_contents('jobs.dat');
$exJob = explode(',', $_FileJob);
mysql_query("UPDATE user SET balls = balls + '$exJob[2]' WHERE id = '$user[id]' LIMIT 1");
mysql_query("UPDATE jobs SET time = '" . (time() + 5 * 60) . "', status = '2' WHERE user = '$user[id]' AND status = '1' LIMIT 1");
}
mysql_query("OPTIMIZE TABLE `frends_new`");
header("Location: frend.php?add".SID);
exit;
?>