/
move8.php
executable file
·76 lines (65 loc) · 1.98 KB
/
move8.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
session_start();
include('functions.php');
$x_win = 0;
$o_win = 0;
$board = $_SESSION['board'];
$square1 = strtoupper($_POST['one']);
$square2 = strtoupper($_POST['two']);
$square3 = strtoupper($_POST['three']);
$square4 = strtoupper($_POST['four']);
$square5 = strtoupper($_POST['five']);
$square6 = strtoupper($_POST['six']);
$square7 = strtoupper($_POST['seven']);
$square8 = strtoupper($_POST['eight']);
$square9 = strtoupper($_POST['nine']);
if(($square1 != "X") and ($square2 != "X") and ($square3 != "X") and ($square4 != "X") and ($square5 != "X") and ($square6 != "X") and ($square7 != "X") and ($square8 != "X") and ($square9 != "X")){
header("location: error.html");
}
$board = check_x($board, $square1, $square2, $square3, $square4, $square5, $square6, $square7, $square8, $square9);
$x_win = three_in_a_row_x($board, $x_win);
if($x_win == true){
header("location: xwin.html");
}
$_SESSION['board'] = $board;
?>
<html>
<head>
<title>Player 2's Turn</title>
<link rel='stylesheet' href='style.css' type='text/css' />
<link rel="icon" type="image/ico" href="favicon.ico" />
</head>
<body>
<div id="title">
<p>PHP Tic-Tac-Toe</p>
</div>
<div id="instructions">
Player 2 - Pick one square and type an O in it.
</div>
<div id="box">
<form action="move9.php" method="post">
<div>
<div id="one"><p><? one($board); ?></p></div>
<div id="two"><p><? two($board); ?></p></div>
<div id="three"><p><? three($board); ?></p></div>
</div>
<div>
<div id="four"><p><? four($board) ?></p></div>
<div id="five"><p><? five($board) ?></p></div>
<div id="six"><p><? six($board) ?></p></div>
</div>
<div>
<div id="seven"><p><? seven($board) ?></p></div>
<div id="eight"><p><? eight($board) ?></p></div>
<div id="nine"><p><? nine($board) ?></p></div>
</div>
<div>
<input type="submit" id="next" value="Next..."/>
</div>
</form>
</div>
<div id="reset">
<a href="reset.php">Reset The Game</a>
</div>
</body>
</html>