function ShowLoginBox(){
$f="";
$e="";
print "";
print <<
Welcome to Net-Chess. This site allows people from all over the world to find an opponent and play chess
through a rich web based interface. All of the games here are correspondence chess games, and have strict
user selectable time controls. This way you can find an opponent who will play at the same speed you
like to play at. Everything on the site is free, if you'd like to play, click the "Join" link in the
upper left corner of this page.
OEF;
print "\n\n";
//$a->{username}="Not Logged In";
}
function ShowUserGreating(){
global $db;
global $username;
$q=$db->query("select * from users where username='$username'");
$user=$db->fetch_row_hash($q);
print "Welcome back $username";
print "(".$user['rating'];
if($user['gamesplayed']<20){
print " provisional)";
} else {
print " established)";
}
print ". ";
print "Your record is ".$user['gameswon']."/".$user['gameslost']."/".$user['gamesdrawn']." (w/l/d).";
print "
";
$q=$db->query("select * from tdmessages where username='$username'");
while($message=$db->fetch_row_hash($q)){
print "
";
print "A message from the Site Administrator: ";
print $message{message};
print " Acknowledge Message ";
print "
";
}
print "It's your move in the following games:";
$sql="select id,board,white,black,whitetimeremaining-(".time()."-lastmovedate) as timeleft,whitenotepad as notepad from games where (white='$username' and toplay='white') and gameover=''";
$sql.=" union ";
$sql.="select id,board,white,black,blacktimeremaining-(".time()."-lastmovedate) as timeleft,blacknotepad as notepad from games where (black='$username' and toplay='black') and gameover=''";
$sql.=" order by timeleft limit 10;";
$q=$db->query($sql);
$totalgames=0;
print "
\n";
if($db->num_rows($q)<=0){
print "It's not your move in any games ";
print "Click HERE to get some games started! ";
} else {
print "\n";
}
?>
Games you're following. Show games as a
Diagram
$q=$db->query("select * from followedgames where username='$username'");
if($db->num_rows($q)>0){
?>
Del
Game ID
White
Black
#
Last Move
Comment
Result
$sql= "select a.id,a.toplay,a.board,a.white,a.black,a.lastmovedate,a.gameover,a.whitetimeremaining,a.blacktimeremaining,a.movenumber,b.comment from games a,followedgames b where b.username='$username' and a.id=b.gameid union ";
$sql.="select a.id,a.toplay,a.board,a.white,a.black,a.lastmovedate,a.gameover,a.whitetimeremaining,a.blacktimeremaining,a.movenumber,b.comment from archives a,followedgames b where b.username='$username' and a.id=b.gameid order by id;";
$temp=ShowFollowedGames($sql);
print "
";
} else {
print "You're not following any games. Click here for more information.";
}
$q=$db->query("select * from recentgames where user='$username' order by enddate desc limit 20;");
if($db->num_rows($q)>0){
?>
(click here to find some random high rated games):
";}
}
function ShowAnnouncements(){
$db=new db;
$db->connect_default();
print "
";
print "
Announcements
\n";
$query="select * from phpbb_topics where forum_id=2 order by topic_time desc limit 5;";
$q=$db->query($query);
while($row=$db->fetch_row_hash($q)){
print "
\n";
}
$q=$db->query("select post_time,username from phpbb_posts a,phpbb_users b where b.user_id=a.poster_id order by post_time desc limit 1;");
$row=$db->fetch_row_hash($q);
print "
Last Forum Post: ";
print date("m/d/Y h:ia",$row["post_time"])." by ".$row['username']."
\n";
print "
";
}
function ShowFollowedGames($query){
global $db;
$q=$db->query($query);
$count=0;
$FollowedGamesData="";
while($row=$db->fetch_row_hash($q)){
$time=localtime($row['lastmovedate'],1);
$time['tm_year']+=1900; $time['tm_mon']++;
print "
: ";
$q=$db->query("select gameid,board,count(*) as c from followedgames a, games b where a.gameid=b.id group by gameid,b.board order by c desc limit 20;");
while($row=$db->fetch_row_hash($q)){
print $row['c'].". ";
print "".$row['gameid']." ";
}
print "