View file prezent.php

File size: 7.38Kb
<?

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("inc.php");
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require("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>";
echo "<card id=\"cabinet\" title=\"Подари кредиты другу\">";
echo "<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\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
if($row["skin"]=="0"){echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";}if($row["skin"]=="1"){echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css1.css\"/>";}if($row["skin"]=="2"){echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css2.css\"/>";}if($row["skin"]=="3"){echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css3.css\"/>";}
echo "<title>Подари кредиты другу</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
echo "<form method=\"POST\" action=\"prezent.php?go=view&amp;$ses&amp;ref=$ref\" name=\"auth\">\n";
}
echo $fsize1;
echo "Кому делаем перевод?<br/>\n";
echo "Ник или ID:<br/>\n";
echo $fsize2;
echo "<input name=\"nick\" maxlength=\"13\" title=\"friend\"/><br/>\n";
echo $fsize1;
echo $divide;
echo "Транслитирация ника:<br/>\n";
echo $fsize2;
echo "<select name=\"trun\">\n";
echo "<option value=\"0\">Нет</option>\n";
echo "<option value=\"1\">Да</option>\n";
echo "</select><br/>\n";
echo $fsize1;
echo $divide;
echo "Сколько не жалко?<br/>\n";
echo "От 0 до ".$posts."<br/>\n";
echo $fsize2;
echo "<input name=\"post\" maxlength=\"13\" format=\"*N\"/><br/>\n";
if ($ver=="wml"){
echo $fsize1;
echo "<anchor title=\"go\">Подарить<go href=\"prezent.php?go=view&amp;$ses&amp;ref=$ref\" method=\"post\">\n";
echo "<postfield name=\"nick\" value=\"$(nick)\"/>\n";
echo "<postfield name=\"post\" value=\"$(post)\"/>\n";
echo "<postfield name=\"trun\" value=\"$(trun)\"/>\n";
echo "</go></anchor>\n";
echo $fsize2;
echo "<br/>";
}else{
echo "<input type=\"submit\" value=\"Подарить\" name=\"enter\"><br/>\n";
}
echo $fsize1;
echo $divide;
echo "<a href=\"cabinet.php?$ses&amp;ref=$ref\">Личный кабинет</a><br/>\n";
echo $fsize2;
include_once"foot2.php";
exit;
}

if(@$go == "view"){
if (!ctype_digit($nick)) {
if($trun==1)$nick=trun_to_rus($nick);
$nick=trim($nick);
$post=trim($post);
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>";
echo "<card id=\"error\" title=\"Ошибка\" ontimer=\"prezent.php?$ses&amp;ref=$ref\"><timer value=\"15\"/>";
echo "<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\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
if($row["skin"]=="0"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";}
if($row["skin"]=="1"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css1.css\"/>";}
if($row["skin"]=="2"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css2.css\"/>";}
if($row["skin"]=="3"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css3.css\"/>";}
echo "<title>Ошибка</title>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=prezent.php?$ses&amp;ref=$ref\">";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
}
echo $fsize1;
echo "Юзер не найден. Возможно ник удалён.<br/>";
echo $divide;
echo "<a href=\"prezent.php?$ses&amp;rm=$rm&amp;ref=$ref\">Назад</a><br/>\n";
echo $fsize2;
if ($ver=="wml")echo "</p></card></wml>";
else echo "</div></body></html>";
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";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>\n";
echo "<card id=\"results\" title=\"Найдено\">\n";
echo "<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\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
if($row["skin"]=="0"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css.css\"/>";}
if($row["skin"]=="1"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css1.css\"/>";}
if($row["skin"]=="2"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css2.css\"/>";}
if($row["skin"]=="3"){
echo "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/css3.css\"/>";}
echo "<title>Найдено</title>";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=cabinet.php?$ses&amp;ref=$ref\">";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>";
echo "<div align=\"center\">";
}
echo $fsize1;

if($id==$usid){
print "И как это вы себе решили кредиты подарить? Такое не возможно!!!.<br/>";
}else{
if ($post>$posts){
echo "У Вас недостаточно кредитов для данного подарка.<br/>";
}else{
$perc="5";
$percent = ($perc*$post)/100;
$summ = $post-$percent;

$data = date("d-M-Y [H:i]");
$kol = rand(0,99999999);
$time = time();
$topic = "Подарок!!!";
$message = "Приветствую <b>".$nick."</b>!!! На ваш баланс зачислено <b>".$summ."</b> кредитов. Подарок от юзера ".$user.".";

if (!ctype_digit($id)) {header("Location: index.php"); die;}
if (!ctype_digit($usid)) {header("Location: index.php"); die;}
if (!ctype_digit($post)) {header("Location: index.php"); die;}
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 ='559';");
print "Подарок для <b>".$nick."</b> успешно доставлен.<br/>";
} else {
print "Ошибка. Подарок не доставлен.<br/>";
}
}
}
print $divide;
echo "<a href=\"cabinet.php?$ses&amp;ref=$ref\">Личный кабинет</a><br/>\n";
echo $fsize2;
include_once"foot2.php";
exit;
}
?>