Рефактор кода

This commit is contained in:
Igor Barkov [iwork] 2018-07-02 16:30:18 +03:00
parent 0b89ad92c0
commit f7d9d710e5

View File

@ -1,6 +1,8 @@
<? <?
session_start(); session_start();
if(!isset($_SESSION['uid'])) { header('Location: /index.php'); } if (!isset($_SESSION['uid'])) {
header('Location: /index.php');
}
include('config.php'); include('config.php');
include('functions.php'); include('functions.php');
include('classes/quests_class.php'); include('classes/quests_class.php');
@ -39,7 +41,8 @@ if($_GET['go_to']) {
header('Location: city.php'); header('Location: city.php');
} }
function info_quest($id) { function info_quest($id)
{
$sp = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . $id . '" LIMIT 1')); $sp = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . $id . '" LIMIT 1'));
if (isset($sp['id'])) { if (isset($sp['id'])) {
return $sp; return $sp;
@ -49,18 +52,16 @@ function info_quest($id) {
} }
if ($_GET['hps']) { if ($_GET['hps']) {
if($user['hp'] == $user['maxhp']) {
$err = 'Ваше здоровье и так полное ...';
} else {
$user['hp'] = $user['maxhp']; $user['hp'] = $user['maxhp'];
mysql_query('UPDATE `users` SET `hp` = "' . $user['hp'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); mysql_query('UPDATE `users` SET `hp` = "' . $user['hp'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
$err = 'Ваше здоровье восстановлено ...'; $err = 'Ваше здоровье восстановлено ...';
}
} }
if($_GET['quids']) { //if ($_GET['quids']) {
#$err = add_quest($user['id'], (int)$_GET['quid']); // #$err = add_quest($user['id'], (int)$_GET['quid']);
} //}
if ($q->error != '') { if ($q->error != '') {
$err = $q->error; $err = $q->error;
@ -71,16 +72,14 @@ if($q->error != '') {
<title>404</title> <title>404</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/hostel.css"/> <link rel="stylesheet" type="text/css" href="css/hostel.css"/>
<script type="text/javascript" src="http://capitalcity.old-dark.ru/js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
</head> </head>
<style> <style>
div.ctContainerA, div.ctContainerB { div.ctContainerA {
position: relative; position: relative;
margin-bottom: 5px; margin-bottom: 5px;
padding: 5px; padding: 5px;
-moz-border-radius: 5px 5px 5px 5px; border-radius: 5px;
-webkit-border-radius: 5px 5px 5px 5px;
-khtml-border-radius: 5px 5px 5px 5px;
} }
div.ctContainerA { div.ctContainerA {
@ -100,30 +99,24 @@ div.ctContent {
width: 100%; width: 100%;
} }
div.quest_target_item div.ctTitle a.action-start { div.quest_target_item div.ctTitle {
float: right; float: right;
} }
div.quest_target_item[forever='1'] div.ctContent .available { div.quest_target_item[forever='1'] div.ctContent {
color: #800; color: #800;
} }
div.quest_target_item[forever='0'][available='0'] div.ctContent .available { div.quest_target_item[forever='0'][available='0'] div.ctContent {
color: blue; color: blue;
} }
div.quest_target_item div.ctContent img.icon { div.quest_target_item div.ctContent {
width: 60px; width: 60px;
height: 60px; height: 60px;
float: left; float: left;
margin: 2px; margin: 2px;
} }
div.qriContainer {
position: relative;
display: inline;
font-size: 80%;
}
</style> </style>
<body> <body>
<div class="contentContainer"> <div class="contentContainer">
@ -132,9 +125,10 @@ div.qriContainer {
<div class="buttonContainer"> <div class="buttonContainer">
<input type="button" class="btns button-route" value="Вернуться" onclick="location.href='?go_to=1';"/> <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';"/> <input type="button" class="btns" value="Обновить" onclick="location.href='quest_room.php';"/>
<? if($user['level'] <= 5 || $user['align'] == 2.99) { ?> <? 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';" /> <input type="button" class="btns" value="Восстановить здоровье"
<? } ?> onclick="location.href='quest_room.php?hps=1';"/>
<? endif ?>
</div> </div>
<div style="float: left; width: 247px;"> <div style="float: left; width: 247px;">
@ -147,18 +141,20 @@ div.qriContainer {
<span>Приветствую тебя, воин!</span> <span>Приветствую тебя, воин!</span>
</div> </div>
<div class="ctContent"> <div class="ctContent">
На памятнике выгравированы опасные задания, за выполнение которых Вы получаете достойную награду!<br /><br /> На памятнике выгравированы опасные задания, за выполнение которых Вы получаете достойную
P.S. Для каждого задания отводится определенный промежуток времени, если задание не сдано вовремя, то Архангел не выдаст Вам награду и придется начать все сначала! Да, тут Вам не ясли, все серьезно! награду!<br/><br/>
P.S. Для каждого задания отводится определенный промежуток времени, если задание не сдано вовремя, то
Архангел не выдаст Вам награду и придется начать все сначала! Да, тут Вам не ясли, все серьезно!
</div> </div>
</div> </div>
<div id="error"> <div id="error">
<? if($err != '') { echo '<center><b style=\'color: Red; text-align: center;\'>'.$err.'</b></center>'; } ?> <? if (!empty($err)) err($err); ?>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
<div class="quest_target_container"> <div class="quest_target_container">
<? echo $qsee; ?> <?= $qsee ?>
</div> </div>
</div> </div>