This repository has been archived by the owner on Mar 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.php
76 lines (76 loc) · 2.67 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
<?php
ini_set('display_errors', 1);
session_start();
?>
<!doctype html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<meta charset="UTF-8">
<title>WhoWillWin</title>
<link rel="stylesheet" href="css/index.css" type="text/css" />
<script src="https://cdn.auth0.com/js/lock/10.14/lock.min.js"></script>
<script>
const lock = new Auth0Lock('KboeNyt4_yis5dVEQ5CSR4VYqEKRh_n5', 'whowillwin.auth0.com', {
auth: {
redirectUrl: "http://localhost"
}
});
</script>
<?php
include 'php/uiRender.php';
include 'php/auth.php';
// if the user information is in the session, get it, otherwise call auth funtion.
$userInfo = $_SESSION['auth0__user'];
if (!$userInfo)
$userInfo = auth();
?>
</head>
<body>
<img src="img/Cham_7.jpg" class="background"></img>
<nav>
<img src="img/logo.png" class="logo"></img>
</nav>
<div class="title">
<div>Who Will Win?</div>
<select name="Team2" id='searchedTeam'>
<option value="All">All </option>
<option value="2">Al-Nassr </option>
<option value="3">Al-Hilal</option>
<option value="1">Al-Shabab</option>
<option value="5">Al-Ahli</option>
<option value="4">Ittihad </option>
</select>
<button id="search">Search</button>
</div>
<div class="container">
<div class="loader" id='loader'></div>
<table class="table" id="table">
<tbody>
</tbody>
</table>
</div>
<div class="login">
<?php
//if the user is not loged in, display the login button
//if the user is loged in, check its privilege in the session, if it is not there, call getUserPrivilege function and store the retrieved privilege in the session.
// then check if the privilege is All, then call addMatch function.
if (!$userInfo) {
echo logInButton();
} else {
$Privilege = $_SESSION['Privilege'];
if (!$Privilege) {
$Privilege = getUserPrivilege($userInfo['user_id']);
$_SESSION['Privilege'] = $Privilege;
}
if ($Privilege == 'ALL') {
echo addMatch();
}
$img = $userInfo['picture'];
echo profile($img);
}
?>
</div>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>