lwb5-in-2025/scripts/game/main/account/library/getUserName.inc

26 lines
496 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class main_account_getUserName {
var $userNames = array(); // FIXME: can be cached
2024-12-31 10:42:58 +01:00
function __construct($lib) {
2016-01-10 11:01:49 +01:00
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function run($uid) {
if (!is_null($this->userNames[$uid])) {
return $this->userNames[$uid];
}
$q = $this->db->query("SELECT name FROM account WHERE id=$uid");
if (!($q && dbCount($q))) {
return null;
}
list($this->userNames[$uid]) = dbFetchArray($q);
return $this->userNames[$uid];
}
}
?>