Внедрение шаблонизатора.

This commit is contained in:
Igor Barkov (iwork) 2020-09-30 14:49:17 +03:00
parent 56a3a437a5
commit 8262dd3f45
3 changed files with 14 additions and 21 deletions

View File

20
buy.php
View File

@ -9,21 +9,19 @@ $is_now = db::c()->query('SELECT `id`, `uid` FROM `abils_user` WHERE `uid` = ?i'
function add_user_abil($ab, $cost) function add_user_abil($ab, $cost)
{ {
global $user, $banks; global $user, $banks;
if (isset($ab)) { if (isset($ab) && $banks['ekr'] >= $cost) {
if ($banks['ekr'] >= $cost) { $isset = mysql_fetch_array(mysql_query('SELECT `id`, `' . $ab . '` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1'));
$isset = mysql_fetch_array(mysql_query('SELECT `id`, `' . $ab . '` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1')); $isset[$ab] += 1;
$isset[$ab] += 1; mysql_query('UPDATE `abils_user` SET `' . $ab . '` = "' . $isset[$ab] . '" WHERE `uid` = "' . $user['id'] . '" LIMIT 1');
mysql_query('UPDATE `abils_user` SET `' . $ab . '` = "' . $isset[$ab] . '" WHERE `uid` = "' . $user['id'] . '" LIMIT 1'); $banks['ekr'] -= $cost;
$banks['ekr'] -= $cost; mysql_query('UPDATE `bank` SET `ekr` = "' . $banks['ekr'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
mysql_query('UPDATE `bank` SET `ekr` = "' . $banks['ekr'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1'); return true;
return true;
}
} }
return false; return false;
} }
$cost = array(1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1); $cost = [1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1];
$mag = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone'); $mag = ['sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone'];
if (isset($_POST['type'], $_POST['user'])) { if (isset($_POST['type'], $_POST['user'])) {
if (isset($user['id'])) { if (isset($user['id'])) {

15
inf.php
View File

@ -1,21 +1,16 @@
<?php <?php
session_start(); session_start();
include_once 'config.php'; include_once 'config.php';
$login = urldecode($_SERVER['QUERY_STRING']) ?? ''; $login = urldecode($_SERVER['QUERY_STRING']) ?? '';
$userInfo = new UserInfo($login); $userInfo = new UserInfo($login);
$presentsModel = new PresentsModel($userInfo->id); $presentsModel = new PresentsModel($userInfo->id);
$presentsList = $presentsModel->getAllPresents(); $presentsList = $presentsModel->getAllPresents();
$userInfo->watcher_id = $userInfo->id ?? null; $userInfo->watcher_id = $userInfo->id ?? null;
Template::header('Информация о'.$userInfo->login); Template::header('Информация о ' . $userInfo->login);
if (!$userInfo->id) {
if (empty($userInfo->id)): ?> sprintf('Ошибка: персонаж <em>%s</em> не найден...<p><a style="color: #99f;" href="javascript:window.history.go(-1);">←назад</a></p>', $login);
Ошибка: персонаж <em><?= $login ?></em> не найден... exit;
<p><a style="color: #99f" href="javascript:window.history.go(-1);">←назад</a></p> }
<?php exit(); endif; ?>
<?php
try { try {
$userInfo->showUserInfo(); $userInfo->showUserInfo();