function Nick type null GLOBAL dbs if is_array id else id DB dbs query

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
function Nick($m, $type = null)
{
GLOBAL $dbs;
if (is_array ($m)) { $id = $m[1]; } else { $id = $m; }
$k = DB :: $dbs -> query("SELECT `id`,`nick`,`sex`,`last`,`level`,`mosh`,`nickcolor1`,`nickcolor2` FROM `us` WHERE ( `id` = ' " . $id . " ')");
$kk = $k -> fetch ();
if($kk){
if($type) {
return '<img src="/files/ico/'. ( $kk['last'] > ( time () - 3600) ? ( file_exists ($_SERVER['DOCUMENT_ROOT'] . '/files/ico/' . $kk['id'] . '.png') ? $kk['id']: ( $kk['sex']=='Муж' ? 'mon' : 'jon' ) ) : ( $kk['sex'] == 'Муж' ? 'mof' : 'jof' ) ) .'.png?' . $kk['id'] . '" alt="*" style="width:18px;height:18px;"/> <b style="color:black;">' . (isset ($kk['nickcolor1'], $kk['nickcolor2']) ? gradient ($kk['nick'], $kk['nickcolor1'], $kk['nickcolor2']) :$kk['nick'] ) . '</b>';
}
else
{
return '<img src="/files/ico/'. ( $kk['last'] > ( time () - 3600) ? ( file_exists ($_SERVER['DOCUMENT_ROOT'] . '/files/ico/' . $kk['id'] . '.png') ? $kk['id']: ( $kk['sex']=='Муж' ? 'mon' : 'jon' ) ) : ( $kk['sex'] == 'Муж' ? 'mof' : 'jof' ) ) .'.png?' . $kk['id'] . '" alt="*" style="width:18px;height:18px;"/> <a href="/us' . $kk['id'] . '" style="text-decoration:none;color:black;"><b>' . (isset ($kk['nickcolor1'], $kk['nickcolor2']) ? gradient ($kk['nick'], $kk['nickcolor1'], $kk['nickcolor2']) :$kk['nick'] ) . '</b></a>';
}
} else {
return '<b style="color:red;">4MAST</b>';
}
}