-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
94 lines (71 loc) · 2.31 KB
/
index.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
session_start();
include_once 'timeout.php';
include_once 'interactions/database.php';
$cookie_name = "cookien";
if(count($_COOKIE) > 0){
if(!isset($_COOKIE[$cookie_name])){
echo '<script>alert("This site use cookie and javascript")</script>';
setcookie($cookie_name, "temp", time() + (3600*24*30*12));
}
} else{
header("Location: error.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="style.css">
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<title>Home</title>
<?php
if($_SERVER['HTTPS'] != "on"){
header("Location: https://" .$_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']);
}
?>
</head>
<body>
<div id="mySidenav" class="sidenav">
<?php
if(isset($_SESSION['Name'])){
echo '<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="userpage.php">Personal Page</a>
<form id="logoutb" action="interactions/logout.php" method="POST">
<a>
<input name="logout" type="submit" value="Logout">
</a>
</form>';
} else{
echo '<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="login.php">Login</a>
<a href="sign_in.php">Sign up</a>';
}
?>
</div>
<div id="main">
<span style="font-size:50px;cursor:pointer" onclick="openNav()">☰</span>
</div>
<h1 id="title" class="text-center font-weight-bold">Game</h1>
<?php
include_once './indextable.php';
?>
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "15%";
document.getElementById("main").style.marginLeft = "10%";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft= "0";
document.body.style.backgroundColor = "white";
}
</script>
<!-- Optional JavaScript -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>