2022-06-06 21:30:34 +00:00
< ? php
2022-08-25 11:23:36 +00:00
function getIP ()
{
return getIPblock ();
2022-06-06 21:30:34 +00:00
}
# <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> IP
2022-08-25 11:23:36 +00:00
function getIPblock ()
{
if ( isset ( $_SERVER [ 'HTTP_X_REAL_IP' ])) {
return $_SERVER [ 'HTTP_X_REAL_IP' ];
}
return $_SERVER [ 'REMOTE_ADDR' ];
2022-06-06 21:30:34 +00:00
}
# <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .
2022-08-25 11:23:36 +00:00
if ( $_SERVER [ 'HTTP_CF_CONNECTING_IP' ] != $_SERVER [ 'SERVER_ADDR' ] && $_SERVER [ 'HTTP_CF_CONNECTING_IP' ] != '127.0.0.1' ) {
die ( 'Hello pussy!' );
}
if ( getIPblock () != $_SERVER [ 'SERVER_ADDR' ] && getIPblock () != '127.0.0.1' && getIPblock () != '' && getIPblock (
) != '5.187.7.71' ) {
die ( getIPblock () . '<br>' . $_SERVER [ 'SERVER_ADDR' ]);
2022-06-06 21:30:34 +00:00
}
2022-08-25 11:23:36 +00:00
const GAME = true ;
2022-06-06 21:30:34 +00:00
2022-08-25 11:23:36 +00:00
require_once ( '_incl_data/__config.php' );
require_once ( '_incl_data/class/__db_connect.php' );
$d = new Dungeon ;
$d -> start ();
2022-06-06 21:30:34 +00:00
2022-08-25 11:23:36 +00:00
function send_chat ( $type , $from , $text , $time )
{
mysql_query (
'INSERT INTO `chat` (`text`,`city`,`login`,`to`,`type`,`new`,`time`,`room`) VALUES ("' . mysql_real_escape_string (
$text
) . '","capitalcity","' . mysql_real_escape_string (
$from
) . '","","' . $type . '","1","' . mysql_real_escape_string ( $time ) . '","3")'
);
2022-06-06 21:30:34 +00:00
}
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
$sp = mysql_query ( 'SELECT * FROM `dungeon_items` WHERE `user` = 0 AND `take` = 0' );
2022-08-25 11:23:36 +00:00
while ( $pl = mysql_fetch_array ( $sp )) {
$fxv = [ 'itm' => mysql_fetch_array (
mysql_query (
'SELECT `im`.*,`ish`.* FROM `dungeon_items` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`id` = "' . mysql_real_escape_string (
$pl [ 'id' ]
) . '" AND `ish`.`take` = "0" AND `ish`.`delete` = "0" LIMIT 1'
)
), 'luck_count' => mysql_fetch_array (
mysql_query (
'SELECT COUNT(*) FROM `dungeon_actions` WHERE `dn` = "' . $pl [ 'dn' ] . '" AND `vars` = "luck_itm' . mysql_real_escape_string (
$pl [ 'id' ]
) . '" LIMIT 1'
)
), 'user_count' => mysql_fetch_array (
mysql_query ( 'SELECT COUNT(*) FROM `stats` WHERE `dnow` = "' . $pl [ 'dn' ] . '" LIMIT 1' )
)];
$fxv [ 'luck_count' ] = $fxv [ 'luck_count' ][ 0 ];
$fxv [ 'user_count' ] = $fxv [ 'user_count' ][ 0 ];
if ( $fxv [ 'itm' ][ 'user' ] <= 0 && $fxv [ 'luck_count' ] >= 1 && ( $fxv [ 'luck_count' ] >= $fxv [ 'user_count' ] || $fxv [ 'itm' ][ 'time' ] + 300 < time (
))) {
$fxv [ 'sp' ] = mysql_query (
'SELECT * FROM `dungeon_actions` WHERE `dn` = "' . $pl [ 'dn' ] . '" AND `vars` = "luck_itm' . mysql_real_escape_string (
$pl [ 'id' ]
) . '" ORDER BY `vals` DESC LIMIT ' . $fxv [ 'luck_count' ]
);
$fxv [ 'winner' ] = [];
$fxv [ 'win_val' ] = 0 ;
while ( $fxv [ 'pl' ] = mysql_fetch_array ( $fxv [ 'sp' ])) {
if ( $fxv [ 'pl' ][ 'vals' ] > $fxv [ 'win_val' ]) {
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
unset ( $fxv [ 'winner' ]);
$fxv [ 'winner' ][] = $fxv [ 'pl' ][ 'uid' ];
$fxv [ 'win_val' ] = $fxv [ 'pl' ][ 'vals' ];
} elseif ( $fxv [ 'pl' ][ 'vals' ] > 0 && $fxv [ 'pl' ][ 'vals' ] == $fxv [ 'win_val' ]) {
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD>
$fxv [ 'winner' ][] = $fxv [ 'pl' ][ 'uid' ];
}
}
unset ( $fxv [ 'pl' ], $fxv [ 'sp' ]);
if ( count ( $fxv [ 'winner' ]) > 1 ) {
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
$fxv [ 'text' ] = 'test2' ;
} elseif ( count ( $fxv [ 'winner' ]) == 1 ) {
$fxv [ 'user_win' ] = mysql_fetch_array (
mysql_query (
'SELECT `id`,`login`,`sex`,`city`,`room` FROM `users` WHERE `id` = "' . $fxv [ 'winner' ][ 0 ] . '" LIMIT 1'
)
);
$fxv [ 'text' ] = '<b>' . $fxv [ 'user_win' ][ 'login' ] . '</b> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> "' . $fxv [ 'itm' ][ 'name' ] . '"' ;
mysql_query (
" INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES (' " . $pl [ 'dn' ] . " ',' " . $fxv [ 'user_win' ][ 'city' ] . " ',' " . $fxv [ 'user_win' ][ 'room' ] . " ','','',' " . $fxv [ 'text' ] . " ',' " . time (
) . " ','6','0','1','1') "
);
mysql_query (
'UPDATE `dungeon_items` SET `time` = "' . time (
) . '",`user` = "' . $fxv [ 'user_win' ][ 'id' ] . '" WHERE `id` = "' . $fxv [ 'itm' ][ 'id' ] . '" LIMIT 1'
);
} else {
//<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
mysql_query ( 'UPDATE `dungeon_items` SET `user` = "1" WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
}
}
unset ( $fxv );
2022-06-06 21:30:34 +00:00
}