-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
51 lines (48 loc) · 1.61 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
<?php
include_once('header.php');
if(isset($_SESSION['user_id']) || isset($_SESSION['username'])){
echo "<script>history.back();</script>";
}
?>
<h1 class="text-hide">Login to your account</h1>
<div class="container"><br>
<div class="row">
<div class="col-md-4 col-lg-4 col-xl-4 mb mx-auto">
<div class="card-4">
<div class='alert alert-danger hide'></div>
<h4 class="text-center card-header">Login to your account</h4><br>
<form id="formLogin">
<label for="user_id" id="label_user">Student ID</label><br>
<input type="text" name="user_id" maxlength="50" class="input-text" id="user_id"><br>
<label for="password">Password</label><br>
<input type="password" name="password" maxlength="50" class="input-text" id="password">
<hr>
<button class="btn btn-primary" id="login" type="submit">Login</button>
</form>
<br>
<div>No account? <a href="signup.php" class="text-blue">Signup here.</a></div>
</div>
</div>
</div>
</div>
<script>
$("#formLogin").submit(function(e){
e.preventDefault();
$.ajax({
url: "process.php",
type: "POST",
dataType: "text",
data: $(this).serialize(),
success: function(res){
if(res == "Login successful"){
history.go(-1);
}else{
$(".alert").removeClass("hide").html(res)
}
}
})
})
</script>
<?php
include('footer.php');
?>