game/lotoworkekr.php
2022-06-07 00:30:34 +03:00

167 lines
4.2 KiB
PHP
Raw Blame History

<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
ini_set('error_reporting', E_ALL);
ini_set("log_errors","1");
ini_set("error_log","php-errors.log");
/*function getIP() {
if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
return $_SERVER['REMOTE_ADDR'];
}
if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1')
{
die(getIP().'<br>'.$_SERVER['SERVER_ADDR']);
}
*/
define('GAME',true);
include('_incl_data/__config.php');
include('_incl_data/class/__db_connect.php');
include('_incl_data/class/__user.php');
$body = file_get_contents('php://input');
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$body.'" LIMIT 1'));
if ($body == 'ekr')
{
echo $u->info['money2'];
die();
}
if(isset($user) && $user['id']==$u->info['id'])
{
if ($user['money2']>=5)
{
$nrnd=rand(1,100);
if ($nrnd <= 1) //t6
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t6"');
$y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t6"'));
$rndt=rand(0,$y['COUNT']-1);
$i=0;
while($pl = mysql_fetch_array($droplistt))
{
if($i==$rndt)
{
$droplist = $pl;
}
$i++;
}
}
elseif (($nrnd-1) <= 7) // t5
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t5"');
$y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t5"'));
$rndt=rand(0,$y['COUNT']-1);
$i=0;
while($pl = mysql_fetch_array($droplistt))
{
if($i==$rndt)
{
$droplist = $pl;
}
$i++;
}
}
elseif (($nrnd-1-7) <= 10) // t4
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t4"');
$y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t4"'));
$rndt=rand(0,$y['COUNT']-1);
$i=0;
while($pl = mysql_fetch_array($droplistt))
{
if($i==$rndt)
{
$droplist = $pl;
}
$i++;
}
}
elseif (($nrnd-1-7-10) <= 15) // t3
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t3"');
$y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t3"'));
$rndt=rand(0,$y['COUNT']-1);
$i=0;
while($pl = mysql_fetch_array($droplistt))
{
if($i==$rndt)
{
$droplist = $pl;
}
$i++;
}
}
elseif (($nrnd-1-7-10-15) <= 25) // t2
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t2"');
$y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t2"'));
$rndt=rand(0,$y['COUNT']-1);
$i=0;
while($pl = mysql_fetch_array($droplistt))
{
if($i==$rndt)
{
$droplist = $pl;
}
$i++;
}
}
else // t1
{
$droplistt = mysql_query('SELECT * FROM `loto` WHERE `type` = "t1"');
$y=mysql_fetch_array(mysql_query('SELECT COUNT(`type`) AS `COUNT` FROM `loto` WHERE `type` = "t1"'));
$rndt=rand(0,$y['COUNT']-1);
$i=0;
while($pl = mysql_fetch_array($droplistt))
{
if($i==$rndt)
{
$droplist = $pl;
}
$i++;
}
}
if (isset($droplist['id']))
{
$idve=$droplist['idgame'];
$u->addItem($idve,$user['id'],'|frompisher=1|nosale=1'.$user['login']);
$inf = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$idve.'" LIMIT 1'));
//$titm = mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("'.$user['id'].'","'.time().'","'.loto.'","'.$user['room'].'","'.$idve.'","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'","loto")');
$u->info['money2'] = $u->info['money2'] - 5;
mysql_query('UPDATE `users` SET `money2`= `money2` - 5 WHERE `id` = "'.$u->info['id'].'"');
if ($droplist['type']=="t6" || $droplist['type']=="t5")
{
mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=#000000><3E><><EFBFBD><EFBFBD><EFBFBD> <b>'.$user['login'].'</b> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <b>'.$inf['name'].'</b>!</font>","capitalcity","","6","1","'.time().'")');
}
echo $droplist['id']; // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/*//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$array = array(
'1' => $droplist['id']', // 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> id <20><><EFBFBD><EFBFBD>
'2' => $u->info['money2'] // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
);
$json = json_encode($array);
echo $json;*/
}
else
{
echo 'Error';
}
}
else
{
echo "No Ekr!";
}
}
else
{
echo "No user!";
}