Фикс mysql запросов

This commit is contained in:
Igor Barkov [iwork] 2018-10-30 20:46:12 +02:00
parent f7d95e3a56
commit f78dbdd75f
5 changed files with 26 additions and 61 deletions

View File

@ -1308,7 +1308,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM
* Смотрим на себя в главном окне игры.
* @param int $pas
*/
function showpersout($pas = 0)
function showpersout($pas = 0) //FIXME Сделать по человечески!
{
global $user;
@ -1336,7 +1336,6 @@ function showpersout($pas = 0)
echoscroll('m3');
echoscroll('m4');
echoscroll('m5');
?>
</TD>
</TR>
@ -1359,21 +1358,21 @@ function showpersout($pas = 0)
<TR>
<TD><?php
if ($user['sergi'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['sergi']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['sergi'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=20 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На серьгах выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img src="i/w1.gif" width=62 height=20 class="tooltip" title="Пустой слот Серьги" />';
echo '<img src="i/w1.gif" width=60 height=20 class="tooltip" title="Пустой слот Серьги" />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['kulon'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['kulon']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['kulon'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1387,7 +1386,7 @@ function showpersout($pas = 0)
<TR>
<TD><?php
if ($user['weap'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['weap']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['weap'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1405,23 +1404,23 @@ function showpersout($pas = 0)
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[bron]' LIMIT 1"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['bron'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '<br />Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '<br />На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '<br />Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '<br />Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '<br />Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '<br />Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '<br />Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '<br />Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '<br />Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '<br />Броня ног: ' . plusorminus($dress['bron4']) . '' : '');
}
if ($user['rybax']) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[rybax]' LIMIT 1"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['rybax'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '<br />Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '<br />На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '<br />Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '<br />Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '<br />Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '<br />Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '<br />Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '<br />Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '<br />Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '<br />Броня ног: ' . plusorminus($dress['bron4']) . '' : '');
}
} elseif ($user['bron']) {
$d = $user['bron'];
if ($user['rybax']) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[rybax]' LIMIT 1"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['rybax'])->fetch_assoc();
$title .= "<br />--------------------<br /><b>$dress[name]</b><br />Прочность $dress[duration]/$dress[maxdur]" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На одежде вышито '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '"';
}
} elseif ($user['rybax']) {
$d = $user['rybax'];
}
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$d}' LIMIT 1"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$d)->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1438,7 +1437,7 @@ function showpersout($pas = 0)
<tr>
<td><?php
if ($user['r1'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r1']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['r1'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
showhrefmagic($dress);
} else {
@ -1450,7 +1449,7 @@ function showpersout($pas = 0)
?></A></td>
<td><?php
if ($user['r2'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r2']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['r2'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1462,7 +1461,7 @@ function showpersout($pas = 0)
?></A></td>
<td><?php
if ($user['r3'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r3']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['r3'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1486,7 +1485,7 @@ function showpersout($pas = 0)
<TR>
<TD><?php
if ($user['helm'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['helm']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['helm'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1500,7 +1499,7 @@ function showpersout($pas = 0)
<TR>
<TD><?php
if ($user['perchi'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['perchi']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['perchi'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1514,7 +1513,7 @@ function showpersout($pas = 0)
<TR>
<TD><?php
if ($user['shit'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['shit']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['shit'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1528,7 +1527,7 @@ function showpersout($pas = 0)
<TR>
<TD><?php
if ($user['boots'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['boots']}' LIMIT 1;"));
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i',$user['boots'])->fetch_assoc();
if ($dress['includemagicdex'] && !$pas) {
echo showhrefmagic($dress);
} else {
@ -1555,8 +1554,6 @@ function showpersout($pas = 0)
</tr>
</tbody>
</table>
</CENTER>
<CENTER>
<TABLE cellPadding=0 cellSpacing=0 width="100%">
<TBODY>

View File

@ -1,12 +0,0 @@
<?php
// магия "шаг назад"
if (rand(1,100)!=1) {
if ($_SESSION['uid'] == null) header("Location: index.php");
mysql_query("UPDATE `users` SET `hp`=`maxhp` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
echo "<font color=red><b>‚ы подкрепили свои силы...<b></font>";
$bet=1;
}
?>

View File

@ -7,8 +7,6 @@ if($user['align'] != 2.99) {
echo 'Вы не можете пользоваться этой магией ...';
} elseif(!isset($us['id'])) {
echo 'Персонаж с логином '.$_POST['target'].' не найден ...';
} elseif($us['align'] == 2.99) {
echo 'Ангелу? Да Вы рехнулись ... Это запрещено!';
} else {
mysql_query('UPDATE `users` SET `align` = "0" WHERE `id` = "'.$us['id'].'" LIMIT 1');
echo 'С персонажа '.$us['login'].' была снята склонность ...';

View File

@ -42,11 +42,8 @@ if($user['align'] != 2.99 && $user['login'] != "father") {
}
mysql_query('UPDATE `abils_vip` SET '.$sql.' WHERE `id` = "'.$vip['id'].'" LIMIT 1');
echo '<b style=\'color: Red;\'>Персонажу '.$us['login'].', '.$t.' '.$types[$type].' аккаунт. Сроком '.$srok.'</b>';
if($user['deal'] > 0) {
$txt = 'Дилер <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
} elseif($user['align'] == 2.99) {
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
}
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
addchp('<font color=red>Внимание!</font> '.$txt, '{[]}'.nick::id($us['id'])->short().'{[]}');
} elseif($type == 2) {
if($us['vip'] == 1) {
@ -67,11 +64,8 @@ if($user['align'] != 2.99 && $user['login'] != "father") {
}
mysql_query('UPDATE `abils_vip` SET '.$sql.' WHERE `id` = "'.$vip['id'].'" LIMIT 1');
echo '<b style=\'color: Red;\'>Персонажу '.$us['login'].', '.$t.' '.$types[$type].' аккаунт. Сроком '.$srok.'</b>';
if($user['deal'] > 0) {
$txt = 'Дилер <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
} elseif($user['align'] == 2.99) {
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
}
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
addchp('<font color=red>Внимание!</font> '.$txt, '{[]}'.nick::id($us['id'])->short().'{[]}');
} elseif($type == 3) {
if($us['vip'] == 1) {
@ -92,11 +86,8 @@ if($user['align'] != 2.99 && $user['login'] != "father") {
}
mysql_query('UPDATE `abils_vip` SET '.$sql.' WHERE `id` = "'.$vip['id'].'" LIMIT 1');
echo '<b style=\'color: Red;\'>Персонажу '.$us['login'].', '.$t.' '.$types[$type].' аккаунт. Сроком '.$srok.'</b>';
if($user['deal'] > 0) {
$txt = 'Дилер <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
} elseif($user['align'] == 2.99) {
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
}
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
addchp('<font color=red>Внимание!</font> '.$txt, '{[]}'.nick::id($us['id'])->short().'{[]}');
}
} else {
@ -115,12 +106,8 @@ if($user['align'] != 2.99 && $user['login'] != "father") {
mysql_query('UPDATE `users` SET `vip` = "'.$type.'", `vip_time` = "'.$n_time.'" WHERE `id` = "'.$us['id'].'" LIMIT 1');
mysql_query('UPDATE `abils_vip` SET '.$sql.' WHERE `id` = "'.$vip['id'].'" LIMIT 1');
echo '<b style=\'color: Red;\'>Персонажу '.$us['login'].', выдан '.$types[$type].' аккаунт. Сроком '.$srok.'</b>';
if($user['deal'] > 0) {
$txt = 'Дилер <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
} elseif($user['align'] == 2.99) {
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
}
$txt = 'Ангел <b>'.$user['login'].'</b> '.$add.' вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
addchp('<font color=red>Внимание!</font> '.$txt, '{[]}'.nick::id($us['id'])->short().'{[]}');
} else {
@ -139,11 +126,8 @@ if($user['align'] != 2.99 && $user['login'] != "father") {
mysql_query('UPDATE `users` SET `vip` = "'.$type.'", `vip_time` = "'.$n_time.'" WHERE `id` = "'.$us['id'].'" LIMIT 1');
mysql_query('INSERT INTO `abils_vip` SET '.$sql.', `uid` = "'.$us['id'].'"');
echo '<b style=\'color: Red;\'>Персонажу '.$us['login'].', выдан '.$types[$type].' аккаунт. Сроком '.$srok.'</b>';
if($user['deal'] > 0) {
$txt = 'Дилер <b>'.$user['login'].'</b> присвоил вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
} elseif($user['align'] == 2.99) {
$txt = 'Ангел <b>'.$user['login'].'</b> присвоил вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
}
$txt = 'Ангел <b>'.$user['login'].'</b> присвоил вам <b>'.$types[$type].' аккаунт</b>, сроком '.$srok.'';
addchp('<font color=red>Внимание!</font> '.$txt, '{[]}'.nick::id($us['id'])->short().'{[]}');
}
}

View File

@ -1,2 +0,0 @@
<?
echo "<font style=\"color: Red;\"><b>Пока не работает ...</b></font>";