-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_info.php
47 lines (47 loc) · 2.2 KB
/
game_info.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?PHP
// Some Chess, a PHP multi-player chess server.
// Copyright (C) 2007 Jon Link
$queryHist = 'SELECT * FROM '.dbPre.'moves WHERE gameID="'.$gameID.'" ORDER BY moveNum';
$resultHist = mysql_query($queryHist)or die('<div class="error">'.errorDBStr.' (im-1)</div>');
$moveNum = mysql_num_rows($resultHist);
for($i=0;$i<$moveNum;++$i) $moves .= '<p><span class="movenum">'.mysql_result($resultHist,$i,'moveNum').'.</span><span class="move">'.mysql_result($resultHist,$i,'whiteMove').'</span>'.mysql_result($resultHist,$i,'blackMove').'</p>';
echo'<div id="history-box">
<div id="history">
<h2>'.$infoBoxStr[0].' (#'.$gameID.')</h2>
'.$moves.'
</div>
</div>
<div id="menu">
<form action="menu.php" method="post" target="_top">
<input type="hidden" name="do" value="resign" />
<input type="hidden" name="gameID" value="',$gameID,'" />
<input type="submit" value="'.$infoBoxStr[1].'" class="butt" />
</form>
<form action="menu.php" method="post" target="_top">
<input type="hidden" name="do" value="draw'.$doDK.'" />
<input type="hidden" name="gameID" value="',$gameID,'" />
<input type="submit" value="'.$infoBoxStr[2].$okayD.'" class="butt" />
</form>';
if($undoB==2 && $allowUndo==1){$okayU = ' ✓';$doUK='OK';}
if($undoB>0 && $allowUndo==1){
echo'<form action="menu.php" method="post" target="_top">
<input type="hidden" name="do" value="undo'.$doUK.'" />
<input type="hidden" name="gameID" value="',$gameID,'" />
<input type="submit" value="'.$infoBoxStr[4].$okayU.'" class="butt" />
</form>';
}
if($endB) echo'<form action="menu.php" method="post" target="_top">
<input type="hidden" name="do" value="end" />
<input type="hidden" name="gameID" value="',$gameID,'" />
<input type="submit" value="'.$infoBoxStr[3].'" class="butt" />
</form>';
echo'<a href="game.php?do=display&gameID=',$gameID,'&status=view" class="butt" target="_top">Review</a>
</div>
<div id="info">';
if($message) echo'<div class="look">'.$message.'</div>';
if($error) echo'<div class="badmove">'.$error.'</div>';
if($moving) echo'<div class="moving">'.$moving.'</div>';
if(strpos($lastMove['move'],'#') === false && !$error) echo $turn;
if($undoD==2 && $allowUndo==1){$okayD = ' ✓';$doDK='OK';}
echo'</div>';
?>