Файл: region_clean/perevodkr.php
Строк: 159
<?
#######################################
## 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['gposts'];
$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="perevod" 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="perevodkr.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="perevodkr.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 "<div class = 'd1'><a href="cabinet.php?$ses&ref=$ref">Личный кабинет</a><br/>
<a href="enter.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,gposts from users where latuser = '".$latuser."'");
} else {
$select = mysql_query ("select id,user,gposts from users where ruser = '".$ruser."'");
}
} else {
$select = mysql_query ("select id,user,gposts from users where id = '".$nick."'");
}
if (mysql_affected_rows() == 0) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
<card id="error" title="Ошибка!" ontimer="perevodkr.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=perevodkr.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 "<div class = 'd1'><a href="perevodkr.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=perevodkr.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 {
$perc = 5;
$percent = ($perc*$post)/100;
$summ = $post-$percent;
$summ = intval($summ);
$post = intval($post);
$percent = intval($percent);
$data = date("d-M-Y [H:i]");
$kol = rand(0,99999999);
$time = time();
$topic = "Подарок!!!";
$message = "Приветствую <b>" .$nick. "</b>!!! На твой баланс зачислено <b>" .$summ. "</b> кредитов. Подарок от юзера " .$user. ".";
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 gposts=gposts-'".$post."' where id ='".$id."';") &&
mysql_query ("Update users set gposts=gposts+'".$summ."' where id ='".$usid."';")) {
mysql_query ("Update users set gposts=gposts+'".$percent."' where id ='1';");
echo 'Подарок для <b>' . col_n($nick) . '</b> успешно доставлен.<br/>';
} else {
echo 'Ошибка! Подарок не доставлен.<br/>';
}
}
}
echo "<div class = 'd1'><a href="cabinet.php?$ses&ref=$ref">Личный кабинет</a><br/>
<a href="enter.php?$ses&ref=$ref">Прихожая</a></div>n";
echo $fsize2;
include_once "foot.php";
exit;
}
?>