pre-final

This commit is contained in:
lopar 2019-01-16 02:20:15 +02:00
parent 0ca08d3b55
commit eda92a531c
1 changed files with 42 additions and 122 deletions

View File

@ -1,45 +1,46 @@
<?
<?php
session_start();
if (!isset($_SESSION['uid'])) {
header('Location: /index.php');
}
include('config.php');
include('functions.php');
require_once 'functions.php';
include('classes/quests_class.php');
$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 = 'Вы исцелились!';
}
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) {
$err = 'У вас уже есть такое задание ...';
$status = 'У вас уже есть такое задание ...';
} elseif ($q->testGood($pl, $user['id']) == 3) {
$err = 'Необходимо завершить квесты ...';
$status = 'Необходимо завершить квесты ...';
} elseif ($q->testGood($pl, $user['id']) == 4) {
$err = 'Задержка на выполнение задания ...';
$status = 'Задержка на выполнение задания ...';
} elseif ($q->testGood($pl, $user['id']) == 5) {
$err = 'Достигнут лимит выполнения заданий ...';
$status = 'Достигнут лимит выполнения заданий ...';
} else {
$err = $q->testGood($pl, $user['id']);
$status = $q->testGood($pl, $user['id']);
}
}
$qsee = '';
$questList = '';
$sp = mysql_query('SELECT * FROM `quests` WHERE `delete` = 0 ORDER BY `id` DESC');
while ($pl = mysql_fetch_array($sp)) {
$qsee .= $q->list_quest($pl, $user['id']);
}
$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']);
if ($qsee == '') {
$qsee = '<center>К сожалению заданий сейчас нету ...</center>';
}
if ($_GET['go_to']) {
mysql_query('UPDATE `users`,`online` SET `users`.`room` = 20, `online`.`room` = 20 WHERE `users`.`id` = "' . $user['id'] . '" AND `online`.`id` = "' . $user['id'] . '"');
header('Location: city.php');
}
if (empty($questList)) $questList = 'Нет заданий.';
function info_quest($id)
{
@ -51,112 +52,31 @@ function info_quest($id)
}
}
if ($_GET['hps']) {
$user['hp'] = $user['maxhp'];
mysql_query('UPDATE `users` SET `hp` = "' . $user['hp'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
$err = 'Ваше здоровье восстановлено ...';
}
//if ($_GET['quids']) {
// #$err = add_quest($user['id'], (int)$_GET['quid']);
//}
if ($q->error != '') {
$err = $q->error;
}
if (!empty($q->error)) $status = $q->error;
?>
<html>
<head>
<title>404</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/hostel.css"/>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<style>
div.ctContainerA {
position: relative;
margin-bottom: 5px;
padding: 5px;
border-radius: 5px;
}
div.ctContainerA {
border: 2px groove threedface;
}
div.ctTitle {
margin-bottom: 3px;
border-bottom: 2px groove threedface;
font-weight: bold;
color: #bf0000;
}
div.ctContent {
overflow: hidden;
position: relative;
width: 100%;
}
div.quest_target_item div.ctTitle {
float: right;
}
div.quest_target_item[forever='1'] div.ctContent {
color: #800;
}
div.quest_target_item[forever='0'][available='0'] div.ctContent {
color: blue;
}
div.quest_target_item div.ctContent {
width: 60px;
height: 60px;
float: left;
margin: 2px;
}
</style>
<body>
<div class="contentContainer">
<h1>Памятник Архангелу</h1>
<div class="buttonContainer">
<input type="button" class="btns button-route" value="Вернуться" onclick="location.href='?go_to=1';"/>
<input type="button" class="btns" value="Обновить" onclick="location.href='quest_room.php';"/>
<? if (($user['level'] <= 5 OR $user['admin'] == 1) AND $user['hp'] == $user['maxhp']): ?>
<input type="button" class="btns" value="Восстановить здоровье"
onclick="location.href='quest_room.php?hps=1';"/>
<? endif ?>
</div>
<div style="float: left; width: 247px;">
<img src="i/pamyatnik.jpg" style="border-radius: 3px; margin-bottom: 5px;"/>
</div>
<div style="margin-left: 250px;">
<div class="ctContainerA">
<div class="ctTitle">
<span>Приветствую тебя, воин!</span>
</div>
<div class="ctContent">
На памятнике выгравированы опасные задания, за выполнение которых Вы получаете достойную
награду!<br/><br/>
P.S. Для каждого задания отводится определенный промежуток времени, если задание не сдано вовремя, то
Архангел не выдаст Вам награду и придется начать все сначала! Да, тут Вам не ясли, все серьезно!
</div>
</div>
<div id="error">
<? if (!empty($err)) err($err); ?>
</div>
<div style="clear: both;"></div>
</div>
<div class="quest_target_container">
<?= $qsee ?>
</div>
<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>
<p><img src="i/pamyatnik.jpg"></p>
</div>
<h1>Памятник</h1>
<div><?php if (!empty($status)) err($status); ?></div>
<div>
На памятнике выгравированы опасные задания, за выполнение которых можно получить достойную
награду! Для каждого задания отводится определенный промежуток времени, если задание не сдано вовремя, то
награды не будет и придется начать все сначала.
</div>
<div style="text-align: center;">
<?= $questList ?>
</div>
</body>
</html>