-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.php
65 lines (61 loc) · 2.1 KB
/
start.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
<?php
require_once('dal/dbutil.php');
require_once('util.php');
/**
* Created by PhpStorm.
* User: sumeet
* Date: 18/1/17
* Time: 1:12 AM
*/
if (checkParam('name') && checkParam('phone-number')) {
$name = $_POST['name'];
$phone = $_POST['phone-number'];
$userDetail = getUserDetails($name, $phone);
if (!$userDetail) {
$userId = createNewUser($name, $phone);
$userDetail = array(
'id' => $userId,
'name' => $name,
'phone' => $phone
);
$randQuestion = getRandomQuestion();
storeRandomQuestion($userId, $randQuestion);
}
$userId = $userDetail['id'];
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#9500ca"/>
<link rel="icon" type="image/png" href="css/favicon.png">
<link rel="stylesheet" type="text/css"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript"
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-12">
<h1 class="text-center">Welcome <?php echo $userDetail['name'] ?></h1>
</div>
</div>
<div class="row">
<div class="col-sm-12 text-center pt">
<form action="quiz.php" method="post">
<input type="text" name="name" value="<?php echo $name ?>" hidden>
<input type="text" name="phone-number" value="<?php echo $phone ?>" hidden>
<input type="submit" class="btn btn-success btn-lg" value="Continue the Hunt">
</form>
</div>
</div>
</div>
</body>
</html>
<?php
} else {
header('Location:index.php');
}
?>