Файл: region_clean/games/ugadaika.php
Строк: 71
<?
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "../start.php";
require_once "../sid.php";
header('Cache-Control: no-store, no-cache, must-revalidate');
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";
$posts = $row['gposts'];
$gposts = $row['gposts'];
$my = $stavka;
$master = mt_rand(1,10);
$myvalent = $stavka + $stavka;
$myzhopa = $posts - $stavka;
$mywin = $posts + $myvalent;
$gmyzhopa = $gposts - $stavka;
$gmywin = $gposts + $myvalent;
ob_start();
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
<card id="index" title="Угадай число">
<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="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
switch($mod) {
case 'itog':
if (!ctype_digit($stavka)) {
echo 'Ошибка! Ставка вводится цифрами!<br/>';
break;
}
$stavka = intval($stavka);
if ($stavka > 10) {
echo $fsize1;
echo 'Ставка не должна превышать 10 очков<br/>';
echo $fsize2;
} else {
if ($my < $master) {
$gmyzhopa = abs(intval($gmyzhopa));
mysql_query("update users set gposts='".$gmyzhopa."' where id='$id'");
echo $fsize1;
echo 'Загадано тобой: ' . $my . '<br/>
Мастер загадал: ' . $master . '<br/>';
echo $divide;
echo 'Неудача :(<br/>
Твой проигрыш: ' . $stavka . ' кредитов.<br/>';
echo $fsize2;
}
if ($my == $master) {
$gmywin = abs(intval($gmywin));
mysql_query("update users set gposts='".$gmywin."' where id='$id'");
echo $fsize1;
echo 'Загадано тобой: ' . $my . '<br/>
Мастер загадал: ' . $master . '<br/>';
echo $divide;
echo 'Удача =)<br/>
Твой выигрыш: ' . $myvalent . ' кредитов.<br/>';
echo $fsize2;
}
if ($my > $master) {
$gmyzhopa = abs(intval($gmyzhopa));
mysql_query("update users set gposts='".$gmyzhopa."' where id='$id'");
echo $fsize1;
echo 'Загадано тобой: ' . $my . '<br/>
Мастер загадал: ' . $master . '<br/>';
echo $divide;
echo 'Неудача :(<br/>
Твой проигрыш: ' . $stavka . ' кредитов.<br/>';
echo $fsize2;
}
}
break;
default:
if ($posts < 100) {
echo $fsize1;
echo 'У тебя недостаточно кредитов для игры!<br/>
Необходимо не менее 100 кредитов<br/>';
echo $fsize2;
} else {
echo $fsize1;
echo '<b>Угадай число</b><br/>';
echo $divide;
echo 'Игровой баланс: <b>' . $gposts . '</b><br/>';
echo $divide;
echo 'Твоя ставка:<br/>
От 1 до 10<br/>';
echo $fsize2;
if ($ver == "wml") {
echo "<input name="stavka" title="stavka" maxlength="10" format="*N"/><br/>";
echo $fsize1;
echo "<anchor title="go">Играть<go href="ugadaika.php?$ses&ref=$ref&mod=itog" method="post">
<postfield name="stavka" value="$(stavka)"/>
</go></anchor>";
echo $fsize2;
echo '<br/>';
} else {
echo "<form method="POST" action="ugadaika.php?$ses&ref=$ref&mod=itog" name="stavka">n
<input name="stavka" title="stavka" maxlength="10"/><br/>
<input type="submit" class="ibutton" value="Играть" name="enter"><br/>n";
}
}
break;
}
echo $fsize1;
echo $divide;
if ($mod) echo "<div class = 'd1'><a href="ugadaika.php?$ses&ref=$ref">Угадай число</a></div>";
echo "<div class = 'd1'><a href="../enter.php?$ses&ref=$ref">Прихожая</a></div>";
echo $fsize2;
include_once "../foot.php";
mysql_close($link);
ob_end_flush();
exit;
?>