2022-06-06 21:30:34 +00:00
< ? php
2022-08-25 11:23:36 +00:00
const GAME = true ;
2022-06-06 21:30:34 +00:00
include ( '_incl_data/__config.php' );
include ( '_incl_data/class/__db_connect.php' );
2022-08-25 11:23:36 +00:00
$u = User :: start ();
2022-06-06 21:30:34 +00:00
$body = file_get_contents ( 'php://input' );
2022-08-25 11:23:36 +00:00
$user = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `users` WHERE `id` = "' . $body . '" LIMIT 1' ));
$titm = mysql_fetch_array (
mysql_query (
'SELECT * FROM `actions` WHERE `uid` = "' . $body . '" AND `vals` = "loto" AND `time` > ' . ( time (
) - 24 * 60 * 60 ) . ' ORDER BY `time` DESC LIMIT 1'
)
);
if ( ! isset ( $user ) || $user [ 'id' ] != $u -> info [ 'id' ]) {
echo " No user! " ;
} elseif ( $titm ) {
echo " Wait asign! " ;
} else {
2023-01-10 16:29:32 +00:00
// не редкий > t1 42% чуть чуть редкий > t2 25% немного редкий > t3 15% редкий > t4 10% очень редкий > t5 5% невероятно редкий > t6 3%
2022-08-25 11:23:36 +00:00
/* $droplist = array (
0 => 4514 , t1
2022-06-06 21:30:34 +00:00
1 => 4515 , t1
2022-08-25 11:23:36 +00:00
2 => 4688 , t1
2022-06-06 21:30:34 +00:00
3 => 4689 , t1
4 => 4690 , t1
5 => 5009 , t2
6 => 5008 , t2
7 => 5010 , t2
8 => 5239 , t2
9 => 5069 , t2
10 => 10035 , t1
11 => 10036 , t1
12 => 10037 , t1
13 => 10008 , t3
14 => 10020 , t3
15 => 6112 , t4
16 => 6113 , t4
17 => 6114 , t4
18 => 6115 , t4
19 => 6116 , t4
2022-08-25 11:23:36 +00:00
20 => 6360 , t6
2022-06-06 21:30:34 +00:00
21 => 6462 , t5
22 => 5022 , t6
2022-08-25 11:23:36 +00:00
23 => 5023 , t6
24 => 6445 , t5
2022-06-06 21:30:34 +00:00
25 => 6455 , t3
26 => 10009 , t4
27 => 1032 , t1
28 => 1031 , t1
29 => 1034 t1
2022-08-25 11:23:36 +00:00
); */
$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 ) <= 5 ) // 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 - 5 ) <= 7 ) // 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 - 5 - 7 ) <= 10 ) // 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 - 5 - 7 - 10 ) <= 15 ) // 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 ++ ;
}
}
2022-06-06 21:30:34 +00:00
2022-08-25 11:23:36 +00:00
if ( ! isset ( $droplist [ 'id' ])) {
echo 'Error' ;
} else {
$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")'
);
mysql_query (
2023-01-10 16:29:32 +00:00
'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=#000000>Игрок <b>' . $user [ 'login' ] . '</b> выиграл в бесплатной рулетке <b>' . $inf [ 'name' ] . '</b>!</font>","capitalcity","","6","1","' . time (
2022-08-25 11:23:36 +00:00
) . '")'
);
echo $droplist [ 'id' ]; //
}
2022-06-06 21:30:34 +00:00
}