This commit is contained in:
lopar 2018-03-01 18:56:17 +02:00
parent 5abf451314
commit 271bb7bd71
3 changed files with 76 additions and 151 deletions

View File

@ -17,5 +17,6 @@ $row3 = db::c()->query('select * from `bank` WHERE owner=10929 OR owner=11221')-
print_r($row3);
echo '<hr>';
$obj = new nick(11221);
$obj->get();
$obj = new nick(11221); print_r($obj);
echo '<hr>';
$obj2 = new nick(11221,0);print_r($obj2)

View File

@ -7,16 +7,24 @@
class nick
{
private $user;
function __construct($id)
{
$this->user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
private $id;
private $invis;
function __construct($playerId, $showInvisibility = 1) {
$this->id = $playerId;
$this->invis = $showInvisibility;
}
public function get()
{
return $this->user['login'];
public function login(){
$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$this->id)->fetch_assoc();
if ($this->invis){
$user['login'] = 'невидимка';
$user['level'] = 100;
}
return $user;
}
//$user = db::c()->query('SELECT `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i',$id)->fetch_assoc();
//$invisible = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $id, 1022)->fetch_assoc();
}

View File

@ -1504,35 +1504,9 @@ function nick($user)
return $r;
}
//// nick
//function nicks($user)
//{
// ?>
<!-- <div id=HP><img src="i/align_--><?//
// echo($user['align'] > 0 ? $user['align'] : "0"); ?><!--.gif"/>--><?php //if ($user['klan'] != '') {
// echo '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif">';
// } ?><!--<B>--><?//= $user['login'] ?><!--</B> [--><?//= $user['level'] ?><!--]<a href=inf.php?--><?//= $user['id'] ?><!-- target=_blank><IMG-->
<!-- SRC=i/inf.gif WIDTH=12 HEIGHT=11 ALT="Инф. о --><?//= $user['login'] ?><!--"></a>-->
<!-- <IMG SRC=i/herz.gif WIDTH=10 HEIGHT=10 ALT="Уровень жизни"> <IMG SRC=i/1green.gif-->
<!-- WIDTH='--><?//= (150 * ($user['hp'] / $user['maxhp'])) ?><!--'-->
<!-- HEIGHT=10 ALT="Уровень жизни" name=HP1><IMG-->
<!-- SRC=i/1silver.gif WIDTH='--><?//= (150 - 150 * ($user['hp'] / $user['maxhp'])) ?><!--' HEIGHT=10-->
<!-- ALT="Уровень жизни" name=HP2>: <span id="hp_value">--><?//= $user['hp'] ?><!--<span>/--><?//= $user['maxhp'] ?><!--</div>-->
<!-- --><?//
//}
function mick2s($id, $showinvis = 1)
{
if ($id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT `id`, `name`, `prototype`, `hp` FROM `bots` WHERE `id` = "' . $id . '" LIMIT 1'));
$id = $bots['prototype'];
$user = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
$user['id'] = $bots['id'];
} else {
$user = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
}
if ($user[0]) {
if ($showinvis) {
@ -1551,7 +1525,7 @@ function mick2s($id, $showinvis = 1)
if ($user['klan'] != '') {
$mm .= '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />';
}
$mm .= "<b>{$user['login']}</b> [{$user['level']}]<a href=inf.php?{$user['id']} target=_blank><img src=i/inf.gif width=12 height=11 alt=\"Инф. о {$user['login']}\" /></a>";
$mm .= "<b>{$user['login']}</b> [{$user['level']}]<a href=inf.php?{$user['id']} target=_blank><img src=i/inf.gif alt=\"Инф. о {$user['login']}\" /></a>";
}
return $mm;
}
@ -1559,16 +1533,7 @@ function mick2s($id, $showinvis = 1)
// nick
function nick2($id, $showinvis = 1)
{
if ($id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT `id`, `name`, `prototype`, `hp` FROM `bots` WHERE `id` = "' . $id . '" LIMIT 1'));
$id = $bots['prototype'];
$user = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
$user['id'] = $bots['id'];
} else {
$user = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
}
$user = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `level`, `hp`, `align`, `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if ($user[0]) {
if ($showinvis) {
@ -1583,31 +1548,41 @@ function nick2($id, $showinvis = 1)
$user['maxhp'] = '??';
}
}
?><img src="i/align_<?
echo($user['align'] > 0 ? $user['align'] : "0"); ?>.gif" />
<?php
echo '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif">'; ?>
<B><?= $user['login'] ?>
</B> [<?= $user['level'] ?>]<a href=inf.php?<?= $user['id'] ?> target=_blank><IMG SRC=i/inf.gif WIDTH=12
HEIGHT=11
ALT="Инф. о <?= $user['login'] ?>"></a>
?>
<img src="i/align_<? echo($user['align'] > 0 ? $user['align'] : "0"); ?>.gif" />
<?php echo '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif">'; ?>
<B><?= $user['login'] ?></B> [<?= $user['level'] ?>]<a href=inf.php?<?= $user['id'] ?> target=_blank><IMG SRC=i/inf.gif ALT="Инф. о <?= $user['login'] ?>"></a>
<?
}
}
function nick3($id)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if (isset($user['id'])) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
if ($effect && $id < _BOTSEPARATOR_) {
$user['login'] = '</a><b><i>невидимка</i></b>';
$user['level'] = '??';
$user['id'] = '??';
$user['align'] = '0';
$user['klan'] = '0';
}
if ($user['align'] > 0) {
$mm .= "<img src=\"i/align_" . ($user['align'] > 0 ? $user['align'] : "0") . ".gif\" />";
}
if ($user['klan'] > 0) {
$mm .= '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />';
}
$mm .= "<b>{$user['login']}</b> [{$user['level']}]<a href=inf.php?{$user['login']} target=_blank><img src=i/inf.gif width=12 height=11 /></a>";
}
return $mm;
}
function nick4($id, $st)
{
if ($id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = ' . $id . ' LIMIT 1'));
$id = $bots['prototype'];
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
$user['id'] = $bots['id'];
} 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"));
if ($user[0]) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
@ -1624,39 +1599,9 @@ function nick4($id, $st)
}
}
// nick
function nick7($id)
{
if ($id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$id}' LIMIT 1"));
$id = $bots['prototype'];
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
$user['id'] = $bots['id'];
} else {
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
}
if ($user[0]) {
if ($user['invis']) {
$user['login'] = '<b><i>невидимка</i></b>';
}
return $user['login'];
}
}
function nick5($id, $st)
{
if ($id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$id}' LIMIT 1"));
$id = $bots['prototype'];
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
$user['id'] = $bots['id'];
} 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"));
if ($user[0]) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
@ -1667,6 +1612,33 @@ function nick5($id, $st)
}
}
//function nick6($id)
//{
// $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = ' . $id . ' LIMIT 1'));
// if ($user[0]) {
// $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
// if ($effect) {
// $user['login'] = '</a><b><i>невидимка</i></b>';
// $user['level'] = '??';
// $user['id'] = '??';
// }
// return "" . $user['login'] . "</b> [" . $user['level'] . "] <a href=inf.php?" . $user['id'] . " target=_blank><IMG SRC=i/inf.gif WIDTH=12 HEIGHT=11 ALT=\"Инф. о " . $user['login'] . "\"></a><B>";
// }
//}
function nick7($id)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if ($user[0]) {
if ($user['invis']) {
$user['login'] = '<b><i>невидимка</i></b>';
}
return $user['login'];
}
}
function check_proc($u)
{
$r = 100;
@ -1725,62 +1697,6 @@ function aligntype($a)
return 0;
}
//function nick6($id)
//{
// if ($id > _BOTSEPARATOR_) {
// $bots = mysql_fetch_array(mysql_query('SELECT `id`, `prototype`, `hp`, `name` FROM `bots` WHERE `id` = ' . $id . ' LIMIT 1'));
// $id = $bots['prototype'];
// $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = ' . $id . ' LIMIT 1'));
// $user['login'] = $bots['name'];
// $user['hp'] = $bots['hp'];
// $user['id'] = $bots['id'];
// } else {
// $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = ' . $id . ' LIMIT 1'));
// }
// if ($user[0]) {
// $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
// if ($effect) {
// $user['login'] = '</a><b><i>невидимка</i></b>';
// $user['level'] = '??';
// $user['id'] = '??';
// }
// return "" . $user['login'] . "</b> [" . $user['level'] . "] <a href=inf.php?" . $user['id'] . " target=_blank><IMG SRC=i/inf.gif WIDTH=12 HEIGHT=11 ALT=\"Инф. о " . $user['login'] . "\"></a><B>";
// }
//}
function nick3($id)
{
if ($id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $id . '" LIMIT 1'));
$bot = $bots['prototype'];
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$bot}' LIMIT 1"));
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
$user['id'] = $bots['id'];
} else {
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
}
if (isset($user['id'])) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
if ($effect && $id < _BOTSEPARATOR_) {
$user['login'] = '</a><b><i>невидимка</i></b>';
$user['level'] = '??';
$user['id'] = '??';
$user['align'] = '0';
$user['klan'] = '0';
}
if ($user['align'] > 0) {
$mm .= "<img src=\"i/align_" . ($user['align'] > 0 ? $user['align'] : "0") . ".gif\" />";
}
if ($user['klan'] > 0) {
$mm .= '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />';
}
$mm .= "<b>{$user['login']}</b> [{$user['level']}]<a href=inf.php?{$user['login']} target=_blank><img src=i/inf.gif width=12 height=11 /></a>";
}
return $mm;
}
function ClanImage($clan_id)
{
$clanimg = db::c()->query('SELECT `short` FROM `clans` WHERE `id` = ?i ', $clan_id)->fetch_assoc();