-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
93 lines (79 loc) · 2.37 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
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
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="assets/img/icon.ico">
<title>Wellcome to Riot Bank | Login</title>
<link rel="stylesheet" href="./assets/bootstrap/css/login.css">
<script src="./assets/js/jquery.min.js" charset="utf-8"></script>
</head>
<body>
<form class="login-form" method="post">
<p><img src="./assets/img/icon.ico" width="50px" /></p>
<h1>Riot Bank</h1>
<div class="txtb">
<input type="text" name="stkk">
<span data-placeholder="Account number"></span>
</div>
<div class="txtb">
<input type="password" name="pass">
<span data-placeholder="Password"></span>
</div>
<input type="submit" class="logbtn" name="login" value="Login">
<div class="bottom-text">
<a href="forgot-pass.php">Forgot password?</a>
</div>
<?php include('controll.php');
if (isset($_POST['login'])) {
$login = new Controll();
$selectU = $login->SelectUser($_POST['stkk']);
$selectP = $login->SelectPass($_POST['stkk']);
$selectB = $login->Select_Balance($_POST['stkk']);
if ($selectU == 0) echo "<script>alert('Tài khoản không tồn tại!')</script>";
else {
foreach ($selectP as $sP) {
$sP['pass'];
}
if ($sP['pass'] != $_POST['pass']) echo "<script>alert('Sai pass!')</script>";
else {
foreach($selectB as $sB){
$sB['stk'];
}
if($sB['stk'] == $_POST['stkk']) $balance = $sB['balance'];
$_SESSION['name'] = $sP['name'];
$_SESSION['email'] = $sP['email'];
$_SESSION['stk'] = $sP['stk'];
$_SESSION['balance'] = $balance;
header('location:index.php');
}
}
}
?>
</form>
</body>
</html>
<script type="text/javascript">
$(".txtb input").on("focus", function() {
$(this).addClass("focus");
});
$(".txtb input").on("blur", function() {
if ($(this).val() == "")
$(this).removeClass("focus");
});
</script>
<script>
var close = document.getElementsByClassName("closebtn");
var i;
for (i = 0; i < close.length; i++) {
close[i].onclick = function() {
var div = this.parentElement;
div.style.opacity = "0";
setTimeout(function() {
div.style.display = "none";
}, 600);
}
}
</script>