'.$errmsg.'
'; echo 'Lost your password?

'; } echo '
'; echo '
'; echo 'Username:     '; echo '

'; echo 'Password:     '; echo ''; echo '

'; echo '(Cookies must be enabled to login.)'; echo '
'; if ($releaseinfo) echo '

'.$releaseinfo.'

'; renderPageEnd(null); exit; } /* ---------- Main page ---------- */ /* Render page */ renderPageBegin('OCC - Overview',null,array( 'My Games'=>'index.php?mygames=1', 'Search'=>'search.php', 'Rankings'=>'rankings.php', 'Help'=>'help.php', 'Logout'=>'logout.php'), null); /* Show login info + stats */ $stats=ioLoadUserStats($uid); $gamecount=$stats['wins']+$stats['draws']+$stats['losses']; echo '

'; echo ''; echo '
Logged in as: '.$uid.'   '.$gamecount.' games total, '; echo $stats['wins'].' wins, '.$stats['draws'].' draws, '; echo $stats['losses'].' losses'; echo '

'; /* Update filter for game list and load infos. */ if (isset($_POST) && isset($_POST['search'])) { $_SESSION['allow_newgame']=0; $_SESSION['filter_name']='Search Results'; $_SESSION['filter_loc']=$_POST['location']; if ($_POST['player']=='anyplayer') $_SESSION['filter_plyr']=null; else $_SESSION['filter_plyr']=$_POST['player']; if ($_POST['color']=='anycolor') $_SESSION['filter_clr']=null; else $_SESSION['filter_clr']=$_POST['color']; if ($_POST['opponent']=='anyplayer') $_SESSION['filter_opp']=null; else $_SESSION['filter_opp']=$_POST['opponent']; } else if (isset($_GET) && isset($_GET['mygames'])) { $_SESSION['allow_newgame']=1; $_SESSION['filter_name']='Open Games'; $_SESSION['filter_loc']='opengames'; $_SESSION['filter_plyr']=$uid; $_SESSION['filter_clr']=null; $_SESSION['filter_opp']=null; } $list=ioLoadGameInfoList($_SESSION['filter_loc'],$_SESSION['filter_plyr'], $_SESSION['filter_clr'],$_SESSION['filter_opp']); /* Add mark whether user may move in game */ foreach ($list as $key=>$info) if ($_SESSION['filter_loc']=='opengames' && (($info['white']==$uid && $info['curplyr']=='w') || ($info['black']==$uid && $info['curplyr']=='b'))) $list[$key]['p_maymove']=1; /* If open games are displayed sort games where user may move to top. */ if ($_SESSION['filter_name']=='Open Games') { $greenlist=array(); $redlist=array(); $i=0; $j=count($list); /* required for unique keys for union */ foreach ($list as $info) if ($info['p_maymove']) $greenlist[$i++]=$info; else $redlist[$j++]=$info; $list=$greenlist+$redlist; } /* Display list */ echo '

'.count($list).' '.$_SESSION['filter_name'].'

'; if (count($list)>0) { echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach ($list as $info) { if ($info['p_maymove']) $mark='greenmark.gif'; else $mark='redmark.gif'; $startdate=date('M jS Y H:i',$info['ts_start']); $lastdate=date('M jS Y H:i',$info['ts_last']); echo ''; if ($info['curstate']=='w' || $info['curstate']=='-') echo ''; else echo ''; if ($info['curstate']=='b' || $info['curstate']=='-') echo ''; else echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
White    Black    Moves    Starting Date    Last Move On    
'.$info['white'].''.$info['white'].''.$info['black'].''.$info['black'].''.$info['curmove'].''.$startdate.'  '.$lastdate.'  '; echo 'View
'; } if ($_SESSION['allow_newgame']) echo '

[ New Game ]

'; renderPageEnd(null); ?>