2019-01-16 00:20:15 +00:00
< ? php
2018-01-28 16:40:49 +00:00
session_start ();
2018-07-02 13:30:18 +00:00
if ( ! isset ( $_SESSION [ 'uid' ])) {
header ( 'Location: /index.php' );
}
2019-01-16 00:20:15 +00:00
require_once 'functions.php' ;
2018-01-28 16:40:49 +00:00
include ( 'classes/quests_class.php' );
2019-01-16 00:20:15 +00:00
$get = urldecode ( filter_input ( INPUT_SERVER , 'QUERY_STRING' ));
if ( $get == 'exit' ) {
db :: c () -> query ( 'UPDATE `users`,`online` SET `users`.`room` = 20, `online`.`room` = 20 WHERE `users`.`id` = ?i AND `online`.`id` = ?i' , $_SESSION [ 'uid' ], $_SESSION [ 'uid' ]);
header ( 'Location: city.php' );
}
if ( $get == 'hps' ) {
db :: c () -> query ( 'UPDATE `users` SET `hp` = `maxhp` WHERE `id` = ?i' , $_SESSION [ 'uid' ]);
$status = 'Вы исцелились!' ;
}
2018-07-02 13:30:18 +00:00
if ( isset ( $_GET [ 'quid' ])) {
$pl = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `quests` WHERE `delete` = "0" AND `min_lvl` <= "' . $user [ 'level' ] . '" AND `max_lvl` >= "' . $user [ 'level' ] . '" AND `id` = "' . mysql_real_escape_string ( $_GET [ 'quid' ]) . '" LIMIT 1' ));
if ( isset ( $pl [ 'id' ]) && $q -> testGood ( $pl , $user [ 'id' ]) == 1 ) {
echo $q -> startq ( $pl [ 'id' ], null , $user [ 'id' ]);
} elseif ( $q -> testGood ( $pl , $user [ 'id' ]) == 2 ) {
2019-01-16 00:20:15 +00:00
$status = 'У вас уже есть такое задание ...' ;
2018-07-02 13:30:18 +00:00
} elseif ( $q -> testGood ( $pl , $user [ 'id' ]) == 3 ) {
2019-01-16 00:20:15 +00:00
$status = 'Необходимо завершить квесты ...' ;
2018-07-02 13:30:18 +00:00
} elseif ( $q -> testGood ( $pl , $user [ 'id' ]) == 4 ) {
2019-01-16 00:20:15 +00:00
$status = 'Задержка на выполнение задания ...' ;
2018-07-02 13:30:18 +00:00
} elseif ( $q -> testGood ( $pl , $user [ 'id' ]) == 5 ) {
2019-01-16 00:20:15 +00:00
$status = 'Достигнут лимит выполнения заданий ...' ;
2018-07-02 13:30:18 +00:00
} else {
2019-01-16 00:20:15 +00:00
$status = $q -> testGood ( $pl , $user [ 'id' ]);
2018-07-02 13:30:18 +00:00
}
2018-01-28 16:40:49 +00:00
}
2019-01-16 00:20:15 +00:00
$questList = '' ;
2018-01-28 16:40:49 +00:00
2019-01-16 00:20:15 +00:00
$sp = db :: c () -> query ( 'SELECT * FROM `quests` WHERE `delete` = 0 ORDER BY `id` DESC' );
while ( $pl = $sp -> fetch_assoc ()) $questList .= $q -> list_quest ( $pl , $user [ 'id' ]);
2018-01-28 16:40:49 +00:00
2019-01-16 00:20:15 +00:00
if ( empty ( $questList )) $questList = 'Нет заданий.' ;
2018-01-28 16:40:49 +00:00
2018-07-02 13:30:18 +00:00
function info_quest ( $id )
{
$sp = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `quests` WHERE `id` = "' . $id . '" LIMIT 1' ));
if ( isset ( $sp [ 'id' ])) {
return $sp ;
} else {
return null ;
}
2018-01-28 16:40:49 +00:00
}
2019-01-16 00:20:15 +00:00
if ( ! empty ( $q -> error )) $status = $q -> error ;
2018-01-28 16:40:49 +00:00
?>
< html >
< head >
2018-07-02 13:30:18 +00:00
< meta charset = " utf-8 " >
2019-01-16 00:20:15 +00:00
< link rel = " stylesheet " type = " text/css " href = " css/main.css " />
2018-01-28 16:40:49 +00:00
</ head >
< body >
2019-01-16 00:20:15 +00:00
< div style = " float: right; " >
< ? php if (( $user [ 'level' ] < 5 OR $user [ 'admin' ] == 1 ) AND $user [ 'hp' ] < $user [ 'maxhp' ]) : ?>
< button onclick = " location.href='?hps=1' " > Восстановить здоровье </ button >
< ? endif ?>
< button onclick = " location.href='?' " > Обновить </ button >
< button onclick = " location.href='?exit' " > Вернуться </ button >
</ div >
< h1 > Памятник </ h1 >
< div >< ? php if ( ! empty ( $status )) err ( $status ); ?> </div>
< div >
Н а памятнике выгравированы опасные задания , за выполнение которых можно получить достойную
награду ! Для каждого задания отводится определенный промежуток времени , если задание не сдано вовремя , то
награды не будет и придется начать все сначала .
</ div >
< div style = " text-align: center; " >
< ? = $questList ?>
2018-07-02 13:30:18 +00:00
</ div >
2018-01-28 16:40:49 +00:00
</ body >
</ html >