-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.php
128 lines (115 loc) · 4.1 KB
/
admin.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
<?php
include("database/login.php");
$user = false;
//Log in
if (isset($_REQUEST['pswd']) && isset($_REQUEST['eventName'])) {
//check login
$p = $_REQUEST['pswd'];
$user = logIn($p);
//save credentials
if ($user != false) {
$_SESSION['pswd'] = $p;
}
//save event
$eventSaved = newEvent($_REQUEST['eventName']);
$_SESSION['eventName'] = $_REQUEST['eventName'];
if ($eventSaved != 1) {
echo "<script>alert('New event error, might already be saved in the db');</script>";
}
} else if (isset($_REQUEST['logout'])) {
session_unset();
}
echo ' <script src="js/jquery.js"></script> <!-- jQuery -->
<script src="js/eventSignIn.js"></script>';
include("partials/header.php"); //show our header and CSS
?>
<!-- HTML Always on page -->
<section id="about" class="container content-section text-center">
<div class="col-lg-8 col-lg-offset-2">
<?php
if ($user != null) {
//LOGGED IN PART OF PAGE
?>
<!-- Email only form -->
<form id='memberForm' class="form-horizontal" role="form">
<div class="form-group">
<div class="input-group">
<div class="input-group">
<input id="eventName" type="hidden" name="eventName" value=<?php echo '"'.$_REQUEST['eventName'].'"'; ?>>
<span class="input-group-addon">E-mail (must be @msu.edu)</span>
<input id="email" name="e-mail" type="text" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary">Continue</button>
</form>
<!-- More info form -->
<div id="newMember">
<form id='newMemberForm' class="form-horizontal" role="form">
<div class="form-group">
<div class="input-group">
<div class="input-group">
<span class="input-group-addon">First Name</span>
<input id="first" name="first" type="text" class="form-control">
</div>
</div>
<p></p>
<div class="input-group">
<div class="input-group">
<span class="input-group-addon">Last Name</span>
<input id="last" name="last" type="text" class="form-control">
</div>
</div>
<p></p>
<div class="input-group">
<div class="input-group">
<span class="input-group-addon">Major</span>
<input id="major" name="major" type="text" class="form-control">
</div>
</div>
<p></p>
<div class="input-group">
<div class="input-group">
<span class="input-group-addon">Expected Graduation:</span>
<input id="grad" name="grad" type="text" class="form-control" placeholder="2019">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<script type="text/javascript">$('#newMember').hide();</script>
<!-- Log Out Button
<form method="post" action="admin.php" class="form-horizontal" role="form">
<input type="hidden" name="logout" value="1">
<button type="submit" class="btn btn-default">Log Out</button>
</form> -->
<?php
} else {
//NOT LOGGED IN YET
?>
<!-- Admin panel: password & event title -->
<form method="post" action="admin.php" class="form-horizontal" role="form">
<div class="form-group">
<div class="input-group">
<div class="input-group">
<span class="input-group-addon">Password</span>
<input name="pswd" type="password" class="form-control">
</div>
<p></p>
<div class="input-group">
<span class="input-group-addon">Event Title</span>
<input name="eventName" type="text" class="form-control">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Log in</button>
</form>
<?php
}
?>
</div>
</section>
<?php
include("partials/footer.php");
?>