-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
54 lines (53 loc) · 1.54 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
52
53
54
<?php include 'db_connect.php' ?>
<div class="container-fluid">
<form action="" id="login-frm">
<div class="form-group">
<label for="" class="control-label">Email</label>
<input type="email" name="email" required="" class="form-control">
</div>
<div class="form-group">
<label for="" class="control-label">Password</label>
<input type="password" name="password" required="" class="form-control">
<small><a href="index.php?page=signup" id="new_account">Create New Account</a></small>
</div>
<span class="float-right">
<button class="button btn btn-primary btn-sm">Login</button>
<button class="button btn btn-secondary btn-sm" type="button" data-dismiss="modal">Cancel</button>
</span>
</form>
</div>
<style>
#uni_modal .modal-footer{
display: none
}
</style>
<script>
$('#login-frm').submit(function(e){
e.preventDefault()
start_load()
if($(this).find('.alert-danger').length > 0 )
$(this).find('.alert-danger').remove();
$.ajax({
url:'ajax.php?action=login',
method:'POST',
data:$(this).serialize(),
error:err=>{
console.log(err)
$('#login-form button[type="button"]').removeAttr('disabled').html('Login');
},
success:function(resp){
if(resp == 1){
location.href ='index.php?page=home';
}else{
$('#login-frm').prepend('<div class="alert alert-danger">Username or password is incorrect.</div>')
end_load()
}
}
})
})
$('.number').on('input',function(){
var val = $(this).val()
val = val.replace(/[^0-9 \,]/, '');
$(this).val(val)
})
</script>