-
Notifications
You must be signed in to change notification settings - Fork 1
/
st_login.php
49 lines (45 loc) · 1.31 KB
/
st_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
<?php
ob_start ();
session_start();
require "php/config.php";
require_once "php/functions.php";
$user = new login_registration_class();
if($user->getsession()){
header('Location: st_profile.php');
exit();
}
?>
<?php
$pageTitle = "Student login";
include "header.php";
?>
<div class="loginform fix">
<div class="msg"><h3><i class="fa fa-graduation-cap" aria-hidden="true"></i>Student login</h3></div>
<div class="access">
<?php
if($_SERVER['REQUEST_METHOD'] == "POST"){
$st_id = $_POST['st_id'];
$st_pass = $_POST['st_pass'];
if(empty($st_id) or empty($st_pass)){
echo "<p style='color:red;text-align:center;'>Field must not be empty.</p>";
}else{
$st_pass = md5($st_pass);
$login = $user->st_userlogin($st_id, $st_pass);
if($login){
header('Location: st_profile.php');
}else{
echo "<p style='color:red;text-align:center'>Incorrect Student ID or password</p>";
}
}
}
?>
<form action="" method="post">
<input type="text" name="st_id" placeholder="Student ID" />
<input type="password" name="st_pass" placeholder="password" />
<input type="submit" value="Login" />
</form>
</div>
<p>Not Registered? <a href="">Create an account</a></p>
</div>
<?php include "footer.php"; ?>
<?php ob_end_flush() ; ?>