-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.php
48 lines (42 loc) · 1.36 KB
/
game.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
<?php
require_once "HomePage.php";
$page = new HomePage();
$username1="";
$username2="";
$login=false;
session_start();
if($_SESSION["islog"]==true)
{$login=true;
$username1=$_SESSION["user1"];
$username2=$_SESSION["user2"];
}
$content=<<<EOF
<title>遊戲開始~~</title>
<link href="game.css" rel="stylesheet" type="text/css">
</head>
<h1 id="para" style=" color:blue; font-family: '標楷體', Helvetica, sans-serif; font-size:60px; float:clear; text-align:center;"> ===五子棋=== </h1>
<div id="container"></div>
<br><br>
<div id="answer"></div>
<script type="text/javascript" src="game0.js"></script>
<div id="btn">
<button type="button" id="again" onclick="init()">再來一局 </button>
EOF;
if($login==true){
$content.=<<<EOF
<button type="button" id="again" onclick="iflogin('$login','$username1','$username2')">排名對戰 </button>
EOF;
$db = new mysqli('localhost', 'root', 'gj94ek', 'db0010766');
if ($db->connect_errno) { //連結SQL伺服器
echo 'Error [' . $db->connect_errno . '] ' . $db->connect_error;
exit;}
$qs = "UPDATE score SET Score=Score+10";
$qs.=" WHERE Name='$username1'";
$rs = $db->query($qs);
}
$content.=<<<EOF
EOF;
$page->setContent($content);
$page->setMenuD();
$page->display();
?>