-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
92 lines (80 loc) · 4.58 KB
/
index.php
File metadata and controls
92 lines (80 loc) · 4.58 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
87
88
89
90
91
92
<?php
session_start();
include 'inc/dbConnection.php';
include 'php/source.php';
$dbConn = getDBConnection();
if(!isset($_SESSION["user"])) {
$_SESSION["name"] = "Guest";
}
if(isset($_POST['logout'])){
session_destroy();
header("Location: index.php");
}
?>
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<head>
<title>Movie Insight</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!--Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<?php include 'inc/header.php';
include 'inc/nav.php';
?>
<div class= "wrapper">
<h4 id="welcome">Welcome </h4>
<table>
<tr><td class = "tdIndex">
<form method="POST" class="" name="loginForm">
<?php if( !isset($_SESSION["user"]) ){
echo '<label><b>Username</b></label>';
echo '<input type="text" placeholder="Enter Username" name="username" required class="ittAD">';
echo '<label><b>Password</b></label>';
echo '<input type="password" placeholder="Enter Password" name="password" required class="itpAD">';
echo '<input type="submit" name ="login" value="Login" class="btnAD btn sub" />';
}else{
echo '<img src="img/ticket.png" alt="A pair of generic movie theatre tickets." height="325" width="392">';
echo '<em><h1>Enjoy</h1><br><br></em>';
echo "<a href='profile.php'><div class='btnAD btn'>Profile</div></a>";
}
if(isset($_POST['login'])){
goMain();
}
?>
</form>
<td class = "tdIndex">
<form method="POST" name="register" action="#" onsubmit="return validateForm()">
<label><b>Username</b></label> <span id="usernameError"></span>
<input type="text" name='usernameReg' placeholder="Enter Username" id="username" required class="ittAD" onchange = "checkUserName()">
<label><b>Password</b></label><span id="pwError"></span>
<input type="password" name= 'pwReg' placeholder="Enter Password" id="pw" required class="itpAD">
<label><b>Retype Password</b></label><span id="pwAgainError"></span>
<input type="password" placeholder="Retype Password" id="pwAgain" required class="itpAD">
<label><b>Name</b></label>
<input type="text" name= 'nameReg' placeholder="Your name" id="name" required class="ittAD">
<label><b>Email</b></label><span id="emailError"></span>
<input type="text" name= 'emailReg' placeholder="example@google.com" id="email" required class="ittAD">
<input type="submit" name= 'reg' id ="register" value="Register" class="btnAD btn sub" />
<?php
if( isset($_POST['reg']) ){
addUser();
echo "<h3 id='addUser'>Register Complete.</h3>";
}
?>
</form>
</td></tr>
</table>
</div>
<?php include 'inc/footer.php'; ?>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- jQuery dependent!!! -->
<script src='js/jsValidReg.js'></script>
<script>document.getElementById('welcome').innerHTML += '<?php echo $_SESSION["name"] ?>' </script>
</body>
</html>