-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTicTacToe.php
More file actions
86 lines (61 loc) · 2.23 KB
/
TicTacToe.php
File metadata and controls
86 lines (61 loc) · 2.23 KB
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
77
78
79
80
81
82
83
84
85
86
<?php
session_start();
if(!isset($_SESSION["string"])){$_SESSION["string"]=array(" "," "," "," "," "," "," "," "," ",);}
$string=$_SESSION["string"];
echo $string[2]."asd";
?>
<!DOCTYPE html>
<html >
<head>
<title>Unbeatable TTT</title>
<link rel="stylesheet" href="css/tttNew.css">
</head>
<body style="background-image: url('img/about/back.jpg');";>
<h1>Tic Tac Toe</h1>
<h1><?php
if(isset($_SESSION["message"])) {
echo $_SESSION["message"];
}
?></h1>
<h1 style="color:red"><?php
if(isset($_SESSION["result"])) {
echo $_SESSION["result"];
}
?></h1>
<div class="container-out">
<div class="container-in">
<div class="table-container">
<table align="center">
<tr>
<td><div class="box" onclick="clicked('00')" id="b00"><?php echo $string[0];?></div></td>
<td><div class="box" onclick="clicked('01')" id="b01"><?php echo $string[1];?></div></td>
<td><div class="box" onclick="clicked('02')" id="b02"><?php echo $string[2];?></div></td>
</tr>
<tr>
<td><div class="box" onclick="clicked('10')" id="b10"><?php echo $string[3];?></div></td>
<td><div class="box" onclick="clicked('11')" id="b11"><?php echo $string[4];?></div></td>
<td><div class="box" onclick="clicked('12')" id="b12"><?php echo $string[5];?></div></td>
</tr>
<tr>
<td><div class="box" onclick="clicked('20')" id="b20"><?php echo $string[6];?></div></td>
<td><div class="box" onclick="clicked('21')" id="b21"><?php echo $string[7];?></div></td>
<td><div class="box" onclick="clicked('22')" id="b22"><?php echo $string[8];?></div></td>
</tr>
</table>
<h2 id="message">Player <span id="winner"></span> Wins</h2>
<button id="reset" onclick="clickedNew('XX')">Reset</button>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
function clicked(p1) {
<?php if(!isset($_SESSION["result"])){?>
window.location.href = "tttAPI.php?value=".concat(p1);
<?php } ?>
}
function clickedNew(p1) {
window.location.href = "tttAPI.php?value=".concat(p1);
}
</script>