This commit is contained in:
lopar 2018-03-03 01:49:16 +02:00
parent ef4c72554e
commit b995ad7117
3 changed files with 16 additions and 1435 deletions

View File

@ -13,11 +13,8 @@ echo '<hr>';
$row2 = db::c()->query('select * from `bank` WHERE owner=10929 OR owner=11221')->fetch_row_array();
print_r($row2);
echo '<hr>';
$row3 = db::c()->query('select * from `bank` WHERE owner=10929 OR owner=11221')->fetch_object_array();
print_r($row3);
echo '<hr>';
$obj = new nick(11221); var_dump($obj->login()); echo $obj->login()['login']. $obj->login()['level'];
echo '<hr>';
$obj2 = new nick(11221,0); var_dump($obj2->login()); echo $obj2->login()['login']['level'];
//echo '<hr>';
//$obj2 = new nick(11221,0); var_dump($obj2->login()); echo $obj2->login()['login']['level'];

File diff suppressed because it is too large Load Diff

View File

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