Вход Регистрация
Файл: region_clean/loterea/index.php
Строк: 83
<?php
#######################################
## 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";

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"";
echo ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">";
echo "<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">";
}
$config_bookpost = 5;

$day = date("d.m.y");
$timer = date("H:i");
$curr = time();

$idsd = $_GET['id'];

$r = mysql_query ("select id,user,level from users where id='$idsd';");
$arr = mysql_fetch_array($r);
$lev = $arr['level'];

echo '<b>Главная лотереи</b><br/><br/>';

if (
$action == "") {
$file = file("setting.dat");
$dt = explode("|",$file[0]);
$timer = $dt[1];
$type = $dt[0];

if (
$type == 1) {

$filex = file("list.dat");
$cnt = count($filex);

if (
$lev > 7) {
echo '<a href="
admin.php?action=close&amp;'.$ses.'&amp;ref='.$ref.'">Закрыть лотерею!</a><br/>';}

$filex=file("list.dat");
$countx=count($filex);
$switchx=0;
$wordx="$id";
for (
$ix=0;$ix<$countx;$ix++){
if (trim(
$filex[$ix])==$wordx){$switchx=1;}}
if(
$switchx==1)
{
echo '<b>Ты уже тянул(а) билет!</b>';
} else {
echo '<a href="
index.php?action=go&amp;'.$ses.'&amp;ref='.$ref.'">Тянуть билет!</a>';
}

$dates = date("d.m.H:i", $timer);
$sess = $curr-$timer;
$minute = ceil($sess/60);
echo "
<br/><br/><b>Cтатистика cессии:</b><br/>Дата запуска$dates<br/>Время текущей сессии$minute мин.<br/>Разыграно$cnt билетов<br/><br/>";
}
if (
$type == 0) { $dates = date("d.m.H:i", $timer);
$filex = file("list.dat");
$cnt = count($filex);

if (
$lev > 7) {
echo'<a href="
admin.php?action=start&amp;'.$ses.'&amp;ref='.$ref.'">Старт лотереи!</a><br/>';
}
echo "
Лотерея пока закрыта!<br/><br/><b>Cводка:</b><br/>Дата закрытия$dates<br/>Было разыграно$cnt билетов<br/><br/>";
}
}
if (
$action == go) {

$filex = file("list.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$id";
for (
$ix = 0; $ix < $countx$ix++) {
if (trim(
$filex[$ix]) == $wordx) {
$switchx = 1;
}
}
if (
$switchx == 1)
{
echo 'Нельзя дважды тянуть билет!<br/><br/>';
} else {

$result = mysql_query("SELECT count(`id`) FROM `loterea`");
$cntData = mysql_fetch_row($result);
$count_users = $cntData[0];

$rnd = rand(1,$count_users);

$resultx = mysql_query("SELECT `id`,`posts`,`credits`,`otvet`,`mafosFROM `lotereaWHERE `id`='".$rnd."';");
$row = mysql_fetch_array($resultx);
$uid = $row[0];
$pst = $row[1];
$crd = $row[2];
$otv = $row[3];
$mfs = $row[4];

$my_resultx = mysql_query("SELECT `posts`,`gposts`,`credits`,`mafcreditsFROM `usersWHERE `id`='".$id."';");
$my_row = mysql_fetch_array($my_resultx);
$my_pst = $my_row[0];
$my_crd = $my_row[1];
$my_otv = $my_row[2];
$my_mfs = $my_row[3];

$final_pst = $my_pst + $pst;
$final_crd = $my_crd + $crd;
$final_otv = $my_otv + $otv;
$final_mfs = $my_mfs + $mfs;

mysql_query("
update `usersset posts='" . $final_pst . "'gposts='" . $final_crd . "'credits='" . $final_otv . "'mafcredits='" . $final_mfs . "' where id='" . $id . "';");

$fp=fopen("list.dat","a+");
flock (
$fp,LOCK_EX);
fputs(
$fp,"$idrn");
flock (
$fp,LOCK_UN);
fclose(
$fp);

echo "
ПоздравляемТебе попался билет номер: <b>".$uid."</b>, выиграно: <br/>Постов".$pst."<br/>Кредитов".$crd."<br/>Ответов".$otv."<br/>Мафокредитов".$mfs."<br/><br/>";
}

}


echo '<div clas="
d1"><a href="index.php?'.$ses.'&amp;ref='.$ref.'">Главная</a></div>';
if (
$lev > 7) {
echo '<div clas="
d1"><a href="admin.php?'.$ses.'&amp;ref='.$ref.'">Администрировать!</a></div>';
}
echo '<div clas="
d1"><a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a></div>';
include_once "
../foot.php";
ob_end_flush();
exit;
?>
Онлайн: 0
Реклама