This repository has been archived on 2023-09-19. You can view files and clone it, but cannot push or open issues or pull requests.
AcmlmboardZero/profile.php

102 lines
4.6 KiB
PHP

<?php
require("function.php");
require("layout.php");
$users=mysqli_query($con,"SELECT * FROM users WHERE id = $_GET[id]") or die('error');
$user=mysqli_fetch_array($users);
// $ranks=readranks();
print $header;
if(!$user[name]){
die('User does not exist');
}
//Revise chunk of code for bugs
if($user[posts]){
$threadsposted=mysqli_num_rows(mysqli_query($con,"SELECT posts.*,threads.* FROM posts INNER JOIN threads ON posts.thread = threads.id AND threads.user = $user[id]"));
$lpost=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM posts WHERE user = $_GET[id] ORDER BY date DESC")) or die(mysql_error());
$lthread=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM threads WHERE id = $lpost[thread]")) or die(mysql_error());
$lforum=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM forums WHERE id = $lthread[forum]")) or die(mysql_error());
$lastpostdate=date("m-d-y h:i A",$user[lastposttime]+$tzoff);
if($lthread[id]!="") $lastpost = ", in <a href=thread.php?id=$lthread[id]>$lthread[title]</a> (<a href=forum.php?id=$lforum[id]>$lforum[title]</a>)";
}
//Hacky fix for now
if(!$user[posts]){
$threadsposted=0;
}
$edit="";
if ($loguserid) $euser=mysqli_fetch_array(mysqli_query($con,"SELECT id,debug FROM users WHERE id=$loguserid"));
if ($loguserid && $euser[debug]) {
$edit=" | <a href=edituser.php?id=$_GET[id]>Edit user</a>";
}
$tccellha="<td bgcolor=$tableheadbg";
$tccellhb="><center>$fonthead";
print "$fonttag"."Profile for $user[name]
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
<td>
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder>$tccellha $tccellhb &nbsp; </td> $tccellha $tccellhb <tr>
";
$picture="<img src=$user[picture]>";
if ($user[picture]=="") { $picture=""; }
if ($user[sex]==0) { $namecolor="color=$malecolor"; }
if ($user[sex]==1) { $namecolor="color=$femalecolor"; }
if ($user[sex]==2) { $namecolor="size=-1"; }
if ($user[title]) {
$profile.="$tccell1"."</center><b>Title</font></td>";
$profile.="$tccell1"."</center>$user[title]</td><tr>";
}
$profile.="$tccell1"."</center><b>Total posts</font></td>";
$profile.="$tccell1"."</center>$user[posts]</td><tr>";
$profile.="$tccell2"."</center><b>Threads posted</font></td>";
$profile.="$tccell2"."</center>$threadsposted</td><tr>";
$profile.="$tccell1"."</center><b>Registered on</font></td>";
$profile.="$tccell1"."</center>".date("m-d-y h:i A",$user[regdate]+$tzoff)." (".floor((time()-$user[regdate])/86400)." days ago)</td><tr>";
$profile.="$tccell2"."</center><b>Last post</font></td>";
$profile.="$tccell2"."</center>$lastpostdate$lastpost</td><tr>";
$profile.="$tccell1"."</center><b>Last activity</font></td>";
$profile.="$tccell1"."</center>".date("m-d-y h:i A",$user[lastactivity]+$tzoff)."</td><tr>";
$profile.="$tccell2"."</center><b>Email address</font></td>";
$profile.="$tccell2"."</center><a href=mailto:$user[email]>$user[email]</a></td><tr>";
$profile.="$tccell2"."</center><b>Homepage</font></td>";
if (!$user[homepagename]) {
$user[homepagename]=$user[homepageurl];
}
$profile.="$tccell2"."</center><a href=$user[homepageurl]>$user[homepagename]</a></td><tr>";
$profile.="$tccell1"."</center><b>ICQ number</font></td>";
$profile.="$tccell1"."</center>$user[icq]</td><tr>";
$profile.="$tccell2"."</center><b>User bio</font></td>";
$profile.="$tccell2"."</center>$user[bio]</td><tr>";
$profile.="<td bgcolor=$tablebg2 colspan=2><center>$smallfont"."<a href=postsbyuser.php?id=$_GET[id]>View posts by this user</a>$edit</td>";
print "$profile
</table>
</td>
</table><br>
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
<td>
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder><tr>";
$postdate=date("m-d-y h:i A",$time+$tzoff);
$userpicture="<img width=60 src=\"$user[picture]\">";
if ($user[picture]=="") {
$userpicture="";
}
$tccellha="<td bgcolor=$tableheadbg";
$tccellhb="><center>$fonthead";
$tcellbg="<td bgcolor=$tablebg1 valign=top";
print "
$tccellha width=150$tccellhb"."User</font></td>
$tccellha colspan=1$tccellhb"."Post</td>
<tr>
$tcellbg rowspan=2>$fonttag<a href=profile.php?id=$user[id]><font $namecolor>$user[name]</font></a>$smallfont<br>$user[title]<br>$userpicture<br>
Posts: $user[posts]</td>
$tcellbg height=1>$smallfont"."Posted on $postdate</td><tr>
$tcellbg colspan=2>$fonttag$user[postheader]<br>Example post<br><br><hr width=150 align=left>$user[signature]</td>
";
print "$footer";
?>