/
Login.php
156 lines (134 loc) · 6.89 KB
/
Login.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<!-- NNMTA LOGIN PAGE -->
<!-- Date Modified: 12/8 -->
<!-- Authors: Iinuma, Kepke, Landrito, Lee -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<!-- <link rel="icon" href="http://getbootstrap.com/favicon.ico"> -->
<title>NNMTA</title>
<!-- Bootstrap core CSS -->
<link href="./NNMTA/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="./NNMTA/cover.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="./NNMTA/ie-emulation-modes-warning.js"></script><style>.carbonad,
#content > #right > .dose > .dosesingle,
#content > #center > .dose > .dosesingle,
#carbonads-container
{display:none !important;}</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div class="masthead clearfix">
<div class="inner">
<!-- Top Navigation Bar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="Home.html">NNMTA</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a a href="Home.html">Home</a></li>
<li><a href = "Info.html">About</a></li>
<li><a href="Events.html">Events</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Students<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="Find_teacher.html">Find a teacher</a></li>
<li><a>Join</a></li>
</ul>
</li>
<li><a href="Teachers.html">Teachers</a></li>
<li><a href="Calendar.html">Calendar</a></li>
<li><a href="Contact.html">Contact</a></li>
</ul>
<!-- Login PHP -->
<?php
session_start();
require 'Session/login-session-handler.php';
$login_handler = new LoginSessionHandler();
// If submitting
if ($_SERVER['REQUEST_METHOD'] == "POST") {
// Login using the login information
if ($login_handler->Login($_POST['email'], $_POST['password'])) {
// Alert if success.
echo "<script> alert('Email ".$login_handler->GetLoginInfo()['email']." has logged in.') </script>";
} else {
// Alert if unsusccessful.
echo "<script> alert('Unsuccessfully logged in.') </script>";
}
}
// Check if logged in and set visability.
if($login_handler->IsLoggedIn()) {
$login_visability = "hidden";
$username_visablilty = "";
} else {
$login_visability = "";
$username_visablilty = "hidden";
}
?>
<ul <?php echo $username_visablilty; ?> class="nav navbar-nav navbar-right">
<li><a href="Session/logout.php"> <span class="glyphicon glyphicon-user" aria-hidden="true"></span> <?php echo $_SESSION['login']['email']; ?> </a> </li>
</ul>
<form <?php echo $login_visability; ?> class="navbar-form navbar-right" method="post" role="search">
<div class="form-group">
<input type="text" class="form-control" name="email" placeholder="Email">
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" placeholder="Password">
</div>
<button type="submit" class="btn btn-default">Login</button>
</form>
<!-- End of PHP code to login to database -->
</div><!--/.nav-collapse -->
</div>
</nav>
</div>
</div>
<!-- Info -->
<div class="inner cover">
<h1 class="cover-heading">
Northern Nevada Music Teachers Association
</h1>
<p class="lead">Providing performance and educational opportunites for teachers and students in Northern Nevada.</p>
<p class="lead">
<a href="Info.html" class="btn btn-lg btn-info">Learn more</a>
</p>
</div>
<!-- Footer -->
<div class="mastfoot">
<div class="inner">
<p>ARIA built by Kyle, Renee, Ernest, and Wes.</p>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="./NNMTA/jquery.min.js"></script>
<script src="./NNMTA/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="./NNMTA/ie10-viewport-bug-workaround.js"></script>
</body></html>