-
Notifications
You must be signed in to change notification settings - Fork 1
/
member-login-profile.php
149 lines (137 loc) · 5.85 KB
/
member-login-profile.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
<html lang="en">
<head>
<?php
function navigate( $location = null, $msg = null ) {
if ( $msg == null ) {
echo '<script>window.location.replace("' . $location . '");</script>';
} else {
echo '<script>window.location.replace("' . $location . '?msg=' . $msg . '");</script>';
}
}
?>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>ATI Kegalle - Login</title>
<link href="snackbar.css" rel="stylesheet"/>
<!-- Required bootstrap CSS -->
<!-- Font Awesome -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
rel="stylesheet"
/>
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
rel="stylesheet"
/>
<!-- MDB -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.5.0/mdb.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="loginstyle.css" />
</head>
<body class="main-bg">
<div id="snackbar">Incorrect Username/Password Plese recheck and enter again</div>
<script type="text/javascript" src="snackbar.js"></script>
<?php
session_start();
if(isset($_SESSION["member"]) && $_SESSION["member"] != ""){
//header("location:member-profile.php");
navigate("member-profile.php");
exit;
}
?>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark mb-3" style="background-color:#03045e;">
<!-- Container wrapper -->
<div class="container-fluid">
<!-- Navbar brand -->
<a class="navbar-brand" href="index.html"><img src="assets/logo.png" width="30" height="30" alt=""></a>
<!-- Toggle button -->
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse" data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <i class="fas fa-bars"></i> </button>
<!-- Collapsible wrapper -->
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0 ">
<!-- Link -->
<li class="nav-item"> <a class="nav-link" href="announcement.html">Announcements</a> </li>
<li class="nav-item"> <a class="nav-link" href="gallery.html">Gallery</a> </li>
<li class="nav-item"> <a class="nav-link" href="contact.html">Contact Us</a> </li>
<li class="nav-item"> <a class="nav-link" href="member-enter.html">
<text style="color: aqua;"><strong>Enter ATI</strong> </text>
</a> </li>
<!-- Login Dropdown -->
<li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-mdb-toggle="dropdown" aria-expanded="false"> <i class="fa fa-fw fa-user"></i> </a>
<!-- Dropdown menu -->
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li> <a class="dropdown-item" href="profile.html">Your Profile</a> </li>
<li> <a class="dropdown-item" href="register.html">Register</a> </li>
<li> <a class="dropdown-item" href="login.html">Login</a> </li>
</ul>
</li>
</ul>
</div>
</div>
<!-- Container wrapper -->
</nav>
<!-- Navbar -->
<!--Login form-->
<div class="login-container text-c animated flipInX">
<div>
<h1 class="logo-badge text-whitesmoke"> <span class="fa fa-user-circle"></span> </h1>
</div>
<h3 class="text-whitesmoke">Member Log In</h3>
<p class="text-whitesmoke">Log In</p>
<div class="container-content">
<form class="margin-t" method="post" action="member-login-profile.php" >
<div class="form-group">
<input type="text" class="form-control" placeholder="Username" required name="username"/>
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="*****" required name="password"/>
</div>
<button type="submit" class="form-button button-l margin-b" name="submit"> Sign In </button>
<a class="text-darkyellow" href="forget-password.php"
><small>Forgot your password?</small></a>
<p class="text-whitesmoke text-center"> <small>Do not have an account?</small> </p>
<a class="text-darkyellow" href="member-register.php"><small>Sign Up</small></a>
</form>
<?php
if ( isset( $_POST[ 'submit' ] ) ) {
require 'conn.php';
$username = mysqli_real_escape_string( $conn, $_POST[ 'username' ] );
$password = mysqli_real_escape_string( $conn, $_POST[ 'password' ] );
$sql="SELECT * FROM `member` WHERE `MemUName`='" . $username . "' AND `Mempassword`='" . $password . "';";
$result = $conn->query( $sql );
if ( $result->num_rows > 0 ) {
session_start();
$_SESSION['member']=$username;
//header('Location:member-profile.php');
navigate("member-profile.php");
} else {
/*print( '<script type="text/javascript">
showmessage("Incorrect Username/Password");
</script>');*/
//header('Location:member-login-profile.php?status=fail');
navigate("member-login-profile.php","Failed");
}
$conn->close();
}
?>
<?php if ( isset( $_GET[ 'status' ] ) ) { if ( $_GET[ 'status' ] == "success" ) { print( '<script type="text/javascript"> showmessage("Recode successfully Deleted"); </script>' ); } if ( $_GET[ 'status' ] == "fail" ) { print( '<script type="text/javascript"> showmessage("Incorrect Username/Password"); </script>' ); } } if ( isset( $_GET[ 'msg' ] ) ) { echo($_GET[ 'msg' ]); print( '<script type="text/javascript"> showmessage("' . $_GET[ 'msg' ] . '"); </script>' ); } ?>
</div>
</div>
<!-- Footer -->
<footer class="footer text-center text-white fixed-bottom">
<div
class="text-center p-0"
style="background-color: rgba(0, 0, 0, 0.774)"
> Made with ❤️ by HNDIT 2019 batch. </div>
</footer>
<!-- MDB -->
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.5.0/mdb.min.js"
></script>
</body>
</html>