-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
171 lines (164 loc) · 5.74 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
session_start();
$host = "localhost";
$username = "root";
$password = "root";
$database = "yokotasp_mas1";
$message = "";
try {
$connect = new PDO("mysql:host=$host; dbname=$database", $username, $password);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if(isset($_POST["login"]))
{
if(empty($_POST["username"]) || empty($_POST["password"]))
{
//$message = '<label>All fields are required.</label>';
}
else
{
$query = "SELECT *
FROM users a
LEFT JOIN ref_users_type b ON a.user_type=b.ref_users_type
WHERE username = :username AND password = :password";
$statement = $connect->prepare($query);
$statement->execute(array('username'=>$_POST["username"],'password'=>$_POST["password"]));
if ($statement->rowCount() == 0) {
header('Location: index.php?message=Invalid username and password combination');
}
else {
$row = $statement->fetch(PDO::FETCH_ASSOC);
session_regenerate_id();
$_SESSION['sess_user_id'] = $row['user_mem_no'];
$_SESSION['sess_username'] = $row['username'];
$_SESSION['sess_user_type'] = $row['user_type'];
$_SESSION['sess_user_desc'] = $row['ref_users_desc'];
echo $_SESSION['sess_userrole'];
session_write_close();
if( $_SESSION['sess_user_type'] == "A") {
header('Location: admin_main_dashboard.php');
}
else {
header('Location: user_view_edit_personal_information.php');
}
}
}
}
}
catch(PDOException $error)
{
$message = $error->getMessage();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login | Membership and Accounting System</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/new_master_stylesheet.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="shortcut icon" type="image/png" href="/images/favicon-16x16.png"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<style type="text/css">
.erreur{
display:none;
color:#F00;
font-weight:bold;
}
</style>
</head>
<body>
<div class="logo">
<img src="images/ysc1_logo.png" alt="logo">
</div>
<div class="logo2">
<img src="images/american_japanese_flags.png" alt="flags">
</div>
<br>
<div class="container" style="width:500px;">
<?php
if(isset($_GET['message']))
{
echo '<label class="text-danger">'.$_GET['message'].'</label>';
}
?>
<br>
<br>
<div class="login">
<h3>Club Login Form</h3><br />
</div>
<form method="post">
<label>Username</label>
<input type="text" name="username" id="username" class="form-control" />
<p class="erreur" id="username-erreur">Please enter your username</p>
<br />
<label>Password</label>
<input type="password" name="password" id="password" class="form-control" />
<p class="erreur" id="password-erreur">Please enter your password</p>
<br />
<input type="submit" name="login" class="btn btn-info" value="Login" id="sub-form" />
<br><br>
<p>Forgot your username or password? Click <a href="mailto:YSCsecretary@gmail.com">here</a>.</p>
<br>
<br>
<p><a href="https://www.facebook.com/yokotasportsmensclub/">About Us</a> | <a href="mailto:YSCsecretary@gmail.com">Contact Us</a></p>
</form>
<<<<<<< HEAD
</div>
<br>
<br><br><br><br>
</div>
<p id="login-page-message">Stay up-to-date with YSC events through email annoucements and newsletters! Click <a href="https://facebook.us17.list-manage.com/subscribe?u=38d1ab6fbfefeeab47f7bd995&id=56615443b8">here</a> to sign-up!</p>
<br>
<br>
<div id="social-media">
<!-- Add font-awesome icons -->
<a href="https://www.facebook.com/yokotasportsmensclub/" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-pinterest"></a>
<a href="#" class="fa fa-youtube"></a>
</div>
<br>
<br>
<br>
=======
</div>
<br>
<br><br><br><br>
</div>
<p id="login-page-message">Stay up-to-date with YSC events through email announcements and newsletters! Click <a href="https://facebook.us17.list-manage.com/subscribe?u=38d1ab6fbfefeeab47f7bd995&id=56615443b8">here</a> to sign-up!</p>
<br>
<br>
<div id="social-media">
<!-- Add font-awesome icons -->
<a href="https://www.facebook.com/yokotasportsmensclub/" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-pinterest"></a>
<a href="#" class="fa fa-youtube"></a>
</div>
<br>
<br>
<br>
>>>>>>> 9ebeccfa6c407f3b9c8b549e0ef6aac64ef9384b
<p id="disclaimer">Disclaimer: The information contained within this site is for demonstration purposes. If you have any questions about the content of this site, please message the project team <a href="mailto:kidder.r@husky.neu.edu">here.</a></p>
<footer>
<p>This site is intended for personal use by the members of the Yokota Sportsmen's Club specifically for conducting club business. All rights reserved. Yokota Sportsmen's Club, Fussa-shi, Tokyo, Japan | Yokota Air Base, Tokyo, Japan</p>
<script type="application/javascript">
$( "#sub-form" ).on( "click", function(e) {
if( ($( "#username" ).val() == "") || ($( "#password" ).val() == "") ){
if( $( "#username" ).val() == "" ){
$( "#username-erreur" ).show();
}else{
$( "#username-erreur" ).hide();
}
if( $( "#password" ).val() == "" ){
$( "#password-erreur" ).show();
}else{
$( "#password-erreur" ).hide();
}
return false;
}
});
</script>
</body>
</html>