Файл: region_clean/prezent.php
Строк: 161
<?
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "start.php";
require_once "sid.php";
header("Cache-Control: no-cache");
if ($ver == "wml") header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require_once "inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "version.php";
$user = $row["user"];
$posts = $row["posts"];
$adm = mysql_query ("Select user from users where id='1' LIMIT 1;");
$z = mysql_fetch_array ($adm);
$administration = $z["user"];
if (!isset($go)) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
<card id="postu" title="Подари посты другу">
<p align="center">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Подари посты другу</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">
<form method="POST" action="prezent.php?go=view&$ses&ref=$ref" name="auth">n";
}
echo '<div class = "c4"><b>Перевод постов другу.</b></div><br/>';
echo $fsize1;
echo '<div class = "d1">Кому дарим посты?<br/>
Ник или ID:</div>';
echo $fsize2;
echo "<input name="nick" maxlength="13" title="friend"/><br/>n";
echo $fsize1;
echo 'Транслит: <input type = "checkbox" name = "trun" value = "1"/><br/>';
echo $fsize2;
echo '<div class = "d1">Сколько не жалко?</div>
От 0 до ' . $posts . '<br/>';
echo $fsize1;
echo "<input name="post" maxlength="13" format="*N"/><br/>n";
if ($ver == "wml") {
echo $fsize2;
echo "<anchor title="go">Подарить<go href="prezent.php?go=view&$ses&ref=$ref" method="post">n
<postfield name="nick" value="$(nick)"/>n
<postfield name="post" value="$(post)"/>n
<postfield name="trun" value="$(trun)"/>n
</go></anchor>n";
echo $fsize1;
echo '<br/>';
} else {
echo "<input type="submit" class="ibutton" value="Подарить" name="enter"><br/>n";
}
echo $fsize2;
echo $divide;
echo "<div class = 'd1'><a href="cabinet.php?$ses&ref=$ref">Личный кабинет</a></div>n";
echo $fsize1;
include_once "foot.php";
exit;
}
$nick = mysql_real_escape_string(check($nick));
if (@$go == "view") {
if (!ctype_digit($nick)) {
if ($_POST['trun'] == 1) $nick = trun_to_rus($nick);
$nick = trim($nick);
if ($nick == '') $nick = 0;
$latuser = strtolower($nick);
$ruser = rus_to_k($nick);
if ($ruser == $nick) {
$select = mysql_query ("Select id,user,posts from users where latuser = '".$latuser."'");
} else {
$select = mysql_query ("select id,user,posts from users where ruser = '".$ruser."'");
}
} else {
$select = mysql_query ("select id,user,posts from users where id = '".$nick."'");
}
if (mysql_affected_rows() == 0) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
<card id="error" title="Ошибка" ontimer="prezent.php?$ses&ref=$ref"><timer value="15"/>
<p align="center">";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Ошибка!</title>
<META HTTP-EQUIV="Refresh" CONTENT="2; URL=prezent.php?$ses&ref=$ref">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
echo $fsize1;
echo 'Юзер не найден. Возможно ник удалён.<br/>';
echo $divide;
echo "<div class = 'd1'><a href="prezent.php?$ses&rm=$rm&ref=$ref">Назад</a></div>n";
echo $fsize2;
include_once "foot.php";
mysql_close ($link);
exit;
}
$inf = mysql_fetch_array ($select);
$usid = $inf["id"];
$nick = $inf["user"];
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="results" title="Найдено">n
<p align="center">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Найдено</title>
<META HTTP-EQUIV="Refresh" CONTENT="2; URL=prezent.php?$ses&ref=$ref">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
echo $fsize1;
if ($id == $usid) {
echo 'Себе нельзя дарить посты!!!<br/>';
} else {
if ($post > $posts) {
echo 'У тебя недостаточно постов для перевода!<br/>';
} else {
$data = date("d-M-Y [H:i]");
$kol = rand(0,99999999);
$time = time();
$topic = "Подарок!!!";
$message = "Приветствую <b>" .$nick. "</b>!!! На твой баланс зачислено <b>" .$post. "</b> постов. Подарок от юзера " .$user. ".";
$post = mysql_real_escape_string($post);
$summ = intval($summ);
$post = intval($post);
$percent = intval($percent);
if (mysql_query("Insert into zapiski set klu4='".$kol."', who ='".$administration."', idwho ='1', message = '".$message."', towhom = '".$nick."', idtowhom = '".$usid."', time = '".$time."', readd = '0', topic = '".$topic."', date='".$data."'") &&
mysql_query ("Update users set posts=posts-'".$post."' where id ='".$id."';") &&
mysql_query ("Update users set posts=posts+'".$post."' where id ='".$usid."';")) {
echo 'Подарок для <b>' . col_n($nick) . '</b> успешно доставлен.<br/>';
} else {
echo 'Ошибка! Подарок не доставлен.<br/>';
}
}
}
echo $divide;
echo "<div class = 'd1'><a href="cabinet.php?$ses&ref=$ref">Личный кабинет</a></div>n";
echo $fsize2;
include_once "foot.php";
exit;
}
?>