fetchq("SELECT * FROM users WHERE id=$id");
$windowtitle="$boardname -- Profile for $user[name]";
require 'lib/layout.php';
if (!$user) {
print "$header
$tblstart$tccell1>The specified user doesn't exist.$tblend$footer";
printtimedif($startingtime);
die();
}
$maxposts=$sql->resultq("SELECT posts FROM users ORDER BY posts DESC LIMIT 1");
/* User ratings (disabled)
$users1=$sql->query("SELECT id,posts,regdate FROM users");
while($u=$sql->fetch_array($users1)){
$u['level']=calclvl(calcexp($u['posts'],(ctime()-$u['regdate'])/86400));
if ($u['posts']<0 or $u['regdate']>ctime()) $u['level']=1;
$users[$u['id']]=$u;
}
$ratescore=0;
$ratetotal=0;
$ratings=$sql->query("SELECT userfrom,rating FROM userratings WHERE userrated=$id");
while($rating=@$sql->fetch($ratings)){
$ratescore+=$rating['rating']*$users[$rating['userfrom']]['level'];
$ratetotal+=$users[$rating['userfrom']]['level'];
}
$ratetotal*=10;
$numvotes=mysql_num_rows($ratings);
if($ratetotal) {
$ratingstatus=(floor($ratescore*1000/$ratetotal)/100)." ($ratescore/$ratetotal, $numvotes votes)";
} else {
$ratingstatus="None";
}
if($loguserid and $logpwenc and $loguserid!=$id)
$ratelink=" | Rate user";
*/
$userrank=getrank($user['useranks'],$user['title'],$user['posts'],$user['powerlevel']);
$threadsposted=$sql->resultq("SELECT count(id) AS cnt FROM threads WHERE user=$id",0,"cnt");
$i=0;
$lastpostdate="None";
if($user['posts']) {
$lastpostdate=date($dateformat,$user['lastposttime']+$tzoff);
//$postsfound=$sql->resultq("SELECT count(id) AS cnt FROM posts WHERE user=$id",0,"cnt");
$post = @$sql->fetchq("SELECT id, thread FROM posts WHERE user=$id AND date=$user[lastposttime]");
if ($post && $thread = $sql->fetchq("SELECT title,forum FROM threads WHERE id=$post[1]")) {
$forum = $sql->fetchq("SELECT id,title,minpower FROM forums WHERE id=$thread[forum]");
$thread[0]=str_replace("<","<",$thread[0]);
if ($forum['minpower']>$loguser['powerlevel'] and $forum['minpower'])
$lastpostlink=", in a restricted forum";
else
$lastpostlink=", in $thread[0] ($forum[title])";
}
}
if($log) {
$sendpmsg=" | Send private message";
if($isadmin){
if($user['lastip'])
$lastip="
with IP: $user[lastip]";
$sneek="
$tccell1s colspan=2>View private messages |"
." View favorites |"
//." View votes |"
." Edit user";
}
}
$aim=str_replace(" ","+",$user['aim']);
$schname=$sql->resultq("SELECT name FROM schemes WHERE id=$user[scheme]");
$numdays=(ctime()-$user['regdate'])/86400;
$user['signature']=doreplace($user['signature'],$user['posts'],$numdays,$user['name']);
// $user['signature']=doreplace2($user['signature'],$user['posts'],$numdays,$user['name']);
$user['postheader']=doreplace($user['postheader'],$user['posts'],$numdays,$user['name']);
// $user['postheader']=doreplace2($user['postheader'],$user['posts'],$numdays,$user['name']);
if ($user['picture']) $picture = "
";
if ($user['moodurl']) $moodavatar = " | Preview mood avatar";
$icqicon="
";
if(!$user['icq']){
$user['icq']="";
$icqicon="";
}
$tccellha="$fonthead";
// Todo: This is a clear hack. Remove it.
$birthday = (date('m-d', $user['birthday']) == date('m-d',ctime() + $tzoff));
$rsex = (($birthday) ? 255 : $user['sex']);
$namecolor = getnamecolor($rsex,$user['powerlevel'], false);
$tzoffset=$user['timezone'];
$tzoffrel=$tzoffset-$loguser['timezone'];
$tzdate=date($dateformat,ctime()+$tzoffset*3600);
if($user['birthday']){
$birthday=date("l, F j, Y",$user['birthday']);
$age="(".floor((ctime()-$user['birthday'])/86400/365.2425)." years old)";
}
// RPG fun shit
$exp=calcexp($user['posts'],(ctime()-$user['regdate'])/86400);
$lvl=calclvl($exp);
$expleft=calcexpleft($exp);
$expstatus="Level: $lvl EXP: $exp (for next level: $expleft)";
if($user['posts'] > 0) $expstatus.=" Gain: ".calcexpgainpost($user['posts'],(ctime()-$user['regdate'])/86400)." EXP per post, ".calcexpgaintime($user['posts'],(ctime()-$user['regdate'])/86400)." seconds to gain 1 EXP when idle";
$postavg=sprintf("%01.2f",$user['posts']/(ctime()-$user['regdate'])*86400);
$totalwidth=116;
$barwidth=@floor(($user['posts']/$maxposts)*$totalwidth);
if($barwidth<0) $barwidth=0;
if($barwidth) $baron=" ";
if($barwidth<$totalwidth) $baroff=" ";
$bar=" $baron$baroff ";
if(!$topposts) $topposts=5000;
if($user['posts']) $projdate=ctime()+(ctime()-$user['regdate'])*($topposts-$user['posts'])/($user['posts']);
if(!$user['posts'] or $user['posts']>=$topposts or $projdate>2000000000 or $projdate ";
$homepagename=$user['homepageurl'];
if($user['homepagename']) $homepagename="$user[homepagename] - $user[homepageurl]";
if($user['postbg']) $postbg="";
loadtlayout();
$user['headtext']=$user['postheader'];
$user['signtext']=$user['signature'];
$user['text'] = "Sample text. [quote=fhqwhgads]A sample quote, with a link, for testing your layout.[/quote]This is how your post will appear.";
$user['uid'] = $_GET['id'];
$user['date'] = ctime();
// so that layouts show up regardless of setting (for obvious reasons)
$loguser['viewsig'] = 1;
// shop/rpg such
$shops=$sql->query('SELECT * FROM itemcateg ORDER BY corder');
$eq=$sql->fetchq("SELECT * FROM users_rpg WHERE uid=$id");
$itemids=array_unique(array($eq['eq1'], $eq['eq2'], $eq['eq3'], $eq['eq4'], $eq['eq5'], $eq['eq6'], $eq['eq7']));
$itemids=implode(',', $itemids);
$eqitems=$sql->query("SELECT * FROM items WHERE id IN ({$itemids})");
while($item=$sql->fetch($eqitems)) $items[$item['id']]=$item;
while($shop=$sql->fetch($shops))
$shoplist.="
$tccell1s>$shop[name]
$tccell2s width=100%>".$items[$eq['eq'.$shop['id']]]['name']."
";
/* extra munging for whatever reason */
$user['email'] = urlencode($user['email']);
// AKA
if ($user['aka'] && $user['aka'] != $user['name'])
$aka = "$tccell1l width=150>Also known as $tccell2l>$user[aka]";
else $aka='';
print "
$header
$fonttag Profile for $minipic$user[name]
$tblstart
$tccellh colspan=2>General information
$aka
$tccell1l width=150>Total posts $tccell2l>$user[posts] ($postavg per day) $projdate $bar
$tccell1l width=150>Total threads $tccell2l>$threadsposted
$tccell1l width=150>EXP $tccell2l>$expstatus
". (false ? " $tccell1l width=150>User rating $tccell2l>$ratingstatus" : "") ."
$tccell1l width=150>Registered on $tccell2l>".@date($dateformat,$user['regdate']+$tzoff)." (".floor((ctime()-$user['regdate'])/86400)." days ago)
$tccell1l width=150>Last post $tccell2l>$lastpostdate$lastpostlink
$tccell1l width=150>Last activity $tccell2l>".date($dateformat,$user['lastactivity']+$tzoff)."$lastip
$tblend
$tblstart
$tccellh colspan=2>Contact information
$tccell1l width=150>Email address $tccell2l>$user[email]
$tccell1l width=150>Homepage $tccell2l>$homepagename
$tccell1l width=150>ICQ number $tccell2l>$user[icq] $icqicon
$tccell1l width=150>AIM screen name $tccell2l>$user[aim]
$tblend
$tblstart
$tccellh colspan=2>User settings
$tccell1l width=150>Timezone offset $tccell2l>$tzoffset hours from the server, $tzoffrel hours from you (current time: $tzdate)
$tccell1l width=150>Items per page $tccell2l>". $user['threadsperpage'] ." threads, ". $user['postsperpage'] ." posts
$tccell1l width=150>Color scheme $tccell2l>".$schname."
$tblend
|
$tblstart
$tccellh>RPG status
$tccell1l>
$tblend
$tblstart
$tccellh colspan=2>Equipped Items
$shoplist
$tblend
| |
$tblstart
$tccellh colspan=2>Personal information
$tccell1l width=150>Real name $tccell2l>$user[realname]
$tccell1l width=150>Pronouns $tccell2l>". htmlspecialchars($user['pronouns']) ."
$tccell1l width=150>Location $tccell2l>$user[location]
$tccell1l width=150>Birthday $tccell2l>$birthday $age
$tccell1l width=150>User bio $tccell2l>". dofilters(doreplace2(doreplace($user['bio'], $user['posts'], (ctime()-$user['regdate'])/86400, $user['name']))) ."
$tblend
$tblstart
$tccellh colspan=2>Sample post
$tblend
". threadpost($user, 1) ."
$tblstart
$tccellhs colspan=2>Options
$tccell2s colspan=2>
Show posts |
View threads by this user
$sendpmsg
$ratelink
$moodavatar
$tccell2s colspan=2>
List posts by this user |
Posts by time of day |
Posts by thread |
Posts by forum$sneek
$tblend$footer
";
printtimedif($startingtime);
?>
|