Тесты
This commit is contained in:
parent
48b7adfd47
commit
ec7e82d47b
@ -45,7 +45,7 @@ $userslots = array('sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3',
|
|||||||
|
|
||||||
function getuserdata($id = 0)
|
function getuserdata($id = 0)
|
||||||
{
|
{
|
||||||
if (!$id) $id = filter_input(INPUT_SESSION, 'uid');
|
if (!$id) $id = isset($_SESSION['uid'])?$_SESSION['uid']:NULL; // Хорошее решение проверок, кстати.
|
||||||
if (!$id) return array();
|
if (!$id) return array();
|
||||||
$rec = db::c()->query('SELECT `hp`, `maxhp`, `fullhptime`, `battle` FROM `users` WHERE `id` = "?s"', $id)->fetch_assoc();
|
$rec = db::c()->query('SELECT `hp`, `maxhp`, `fullhptime`, `battle` FROM `users` WHERE `id` = "?s"', $id)->fetch_assoc();
|
||||||
if ($rec['hp'] < $rec['maxhp'] && time() > $rec['fullhptime'] && !$rec['battle'] && ($rec['hp'] > 0)) {
|
if ($rec['hp'] < $rec['maxhp'] && time() > $rec['fullhptime'] && !$rec['battle'] && ($rec['hp'] > 0)) {
|
||||||
@ -1989,8 +1989,7 @@ function echoscroll($slot)
|
|||||||
$script = 'main';
|
$script = 'main';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user['battle'] > 0)
|
if ($user['battle'] > 0) $bat = mysql_fetch_array(mysql_query("SELECT `id`, `magic` FROM `battle` WHERE `id` = '{$user['battle']}' LIMIT 1"));
|
||||||
$bat = mysql_fetch_array(mysql_query("SELECT `id`, `magic` FROM `battle` WHERE `id` = '{$user['battle']}' LIMIT 1"));
|
|
||||||
$all_magic = unserialize($bat['magic']);
|
$all_magic = unserialize($bat['magic']);
|
||||||
$dress = mysql_fetch_array(mysql_query("SELECT `id`, `magic`, `name`, `img`, `duration`, `maxdur` FROM `inventory` WHERE `id` = '{$user[$slot]}' LIMIT 1"));
|
$dress = mysql_fetch_array(mysql_query("SELECT `id`, `magic`, `name`, `img`, `duration`, `maxdur` FROM `inventory` WHERE `id` = '{$user[$slot]}' LIMIT 1"));
|
||||||
$need_charge = mysql_fetch_array(mysql_query("SELECT `needcharge` FROM `magic` WHERE `id` = '{$dress['magic']}' LIMIT 1"));
|
$need_charge = mysql_fetch_array(mysql_query("SELECT `needcharge` FROM `magic` WHERE `id` = '{$dress['magic']}' LIMIT 1"));
|
||||||
@ -2269,18 +2268,21 @@ function regenhp($us, $update = 1)
|
|||||||
return $us['hp'];
|
return $us['hp'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false)
|
function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXME 37 запросов! ТРИДЦАТЬ СЕМЬ! Чтобы отобразить предметы на персонаже.
|
||||||
{
|
{
|
||||||
global $rooms;
|
global $rooms;
|
||||||
$r = '';
|
$r = '';
|
||||||
if ($id > _BOTSEPARATOR_) {
|
if ($id > _BOTSEPARATOR_) { //FIXME Оно как бы и работает, но два тяжёлющих запроса в самые крупные базы, чтобы подменить два значения...
|
||||||
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . (int)$id . '" LIMIT 1'));
|
// $bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . (int)$id . '" LIMIT 1'));
|
||||||
$id = $bots['prototype'];
|
// $id = $bots['prototype'];
|
||||||
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
|
// $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
|
||||||
$user['login'] = $bots['name'];
|
// $user = db::c()->query('SELECT * FROM `users` WHERE `id` = (SELECT `prototype` FROM `bots` WHERE `bots`.`id` = ?i)', $id)->fetch_assoc();
|
||||||
$user['hp'] = $bots['hp'];
|
// $user['login'] = $bots['name'];
|
||||||
|
// $user['hp'] = $bots['hp'];
|
||||||
|
die('Неустранимая ошибка в showinf_pers(), обратитесь к разработчику.');
|
||||||
} else {
|
} else {
|
||||||
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
|
// $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
|
||||||
|
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc()
|
||||||
$invis = $user['invis'];
|
$invis = $user['invis'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2314,9 +2316,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false)
|
|||||||
|
|
||||||
$r .= '<center>';
|
$r .= '<center>';
|
||||||
if ($user['deal'] > 0) {
|
if ($user['deal'] > 0) {
|
||||||
$deal = '<img src=\'i/deal.gif\' /> ';
|
$deal = '💵 ';
|
||||||
} else {
|
|
||||||
$deal = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$r .= "<a href=\"javascript: top.AddToPrivate('$user[login]', top.CtrlPress)\" target=\"refreshed\"><img src=\"/i/lock.gif\" width=\"20\" height=\"15\" /></a>$deal" . ($user['align'] > 0 ? "<img src=\"/i/align_" . $user['align'] . ".gif\" />" : "") . ($user['klan'] != '' ? '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />' : "") . "<b>$user[login]</b> [";
|
$r .= "<a href=\"javascript: top.AddToPrivate('$user[login]', top.CtrlPress)\" target=\"refreshed\"><img src=\"/i/lock.gif\" width=\"20\" height=\"15\" /></a>$deal" . ($user['align'] > 0 ? "<img src=\"/i/align_" . $user['align'] . ".gif\" />" : "") . ($user['klan'] != '' ? '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />' : "") . "<b>$user[login]</b> [";
|
||||||
|
88
test.php
88
test.php
@ -1,83 +1,9 @@
|
|||||||
<?php if (isset($_GET['items'])) {
|
|
||||||
foreach (glob("i/sh/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
foreach (glob("i/sh/Podarki/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
foreach (glob("i/sh/runes/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
exit('EOF');
|
|
||||||
}
|
|
||||||
if (isset($_GET['obraz'])) {
|
|
||||||
foreach (glob("i/shadow/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
exit('EOF');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php require_once('config.php'); ?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Нычка</title>
|
|
||||||
<meta charset=utf-8>
|
|
||||||
</head>
|
|
||||||
<body style="background: silver;">
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (isset($_GET['dbshow'])) {
|
include 'config.php';
|
||||||
|
$items = db::c()->query('SELECT `id`, `name`, `img`, `duration`, `maxdur`,
|
||||||
|
`ghp`, `gsila`, `glovk`, `ginta`, `gintel`,
|
||||||
|
`bron1`, `bron2`, `bron3`, `bron4`,
|
||||||
|
type, prototype, otdel
|
||||||
|
FROM inventory WHERE owner = 10736 AND dressed = 1')->fetch_assoc();
|
||||||
|
|
||||||
$sql = db::c()->query('SELECT * FROM `lichka`')->fetch_assoc();
|
print_r($items);
|
||||||
$table = "<table border=1 width=100% align=center>\n";
|
|
||||||
while ($sql)
|
|
||||||
{
|
|
||||||
$table .= "<tr>\n";
|
|
||||||
$table .= "<th>Lichka\n";
|
|
||||||
$table .= "<td>".$row['id']."</td>\n";
|
|
||||||
$table .= "<td>".$row['pers']."</td>\n";
|
|
||||||
$table .= "<td>".$row['text']."</td>\n";
|
|
||||||
|
|
||||||
$table .= "</tr>\n";
|
|
||||||
}
|
|
||||||
$table .= "</table><p>\n";
|
|
||||||
|
|
||||||
$sql2 = db::c()->query('SELECT * FROM `paldelo`')->fetch_assoc();
|
|
||||||
$table2 = "<table border=1 width=100% align=center>\n";
|
|
||||||
while ($sql2)
|
|
||||||
{
|
|
||||||
$table2 .= "<tr>\n";
|
|
||||||
$table2 .= "<th>Paldelo\n";
|
|
||||||
$table2 .= "<td>".$sql2['id']."</td>\n";
|
|
||||||
$table2 .= "<td>".$sql2['author']."</td>\n";
|
|
||||||
$table2 .= "<td>".$sql2['text']."</td>\n";
|
|
||||||
|
|
||||||
$table2 .= "</tr>\n";
|
|
||||||
}
|
|
||||||
$table2 .= "</table>\n";
|
|
||||||
|
|
||||||
// Выводим заполненую таблицу на экран
|
|
||||||
echo $table.$table2; exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['phpinfo'])) phpinfo();
|
|
||||||
|
|
||||||
echo "Склонности: ";
|
|
||||||
foreach (glob("i/align_*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
echo "<br>Красные Кнопки: ";
|
|
||||||
foreach (glob("i/a__*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
echo "<br>Синие Кнопки: ";
|
|
||||||
foreach (glob("i/b__*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
echo "<br>Медали: ";
|
|
||||||
foreach (glob("i/medal*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
foreach (glob("i/pal*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
foreach (glob("i/tar*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
echo "<br>Свитки: ";
|
|
||||||
foreach (glob("i/magic/*.{jpg,png,gif}", GLOB_BRACE) as $filename) echo "<img src={$filename} title={$filename}> ";
|
|
||||||
|
|
||||||
// Получить все...
|
|
||||||
$res = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i',11263)->fetch_assoc();
|
|
||||||
// Последовательно получать в виде ассоциативных массивов
|
|
||||||
while ($res) print_r($res['id']);
|
|
||||||
echo '<hr>';
|
|
||||||
print_r($res['id']);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user