-
Notifications
You must be signed in to change notification settings - Fork 1
/
login.php
85 lines (70 loc) · 2.57 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
<?php
include 'header.php';
$message = '';
$classes = '';
$message = '';
$visible = 'hide';
if (isset($_GET['account']) && $_GET['account'] == 'created') {
$classes = 'notification is-success';
$message = 'Account created successfully. Enter your details to login';
$visible = '';
}
if (isset($_POST['submit'])) {
$email = $_POST['email'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE email='$email'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
$r = mysqli_fetch_assoc($result);
if (password_verify($password, $r['password'])) {
session_start();
$_SESSION['user_id'] = $r['id'];
header('location: ./dashboard/dashboard.php');
} else {
$classes = 'notification is-danger';
$message = 'Wrong login details. Please Enter the correct details';
$visible = '';
}
} else {
$classes = 'notification is-danger';
$message = 'Wrong login details. Please Enter the correct details';
$visible = '';
}
}
?>
<title>UmatPress - Login</title>
</head>
<body>
<div id="hide-it">
<div class="<?php echo $classes ?>" id="<?php echo $visible ?>">
<button class="delete" onclick="HideText('hide-it');"></button>
<strong><?php echo $message ?></strong>
</div>
</div>
<article class="article1">
<div class="container2 neumor">
<h2 class="divItems">Sign in</h2>
<form method="post" action="./login.php">
<div class="divItems">
<label class="divItems" for="email">
<p class="inputTitle">Email</p>
<input class="input1" name="email" type="email" id="email" placeholder="Enter your Email" required>
</label>
</div>
<div class="divItems">
<label for="password">
<p class="inputTitle"> Password</p>
<input class="input1" name="password" type="text" id="password" placeholder="Enter your Password" class="centerh" required>
</label>
</div>
<div>
<input class="input1 submit" name="submit" type="submit" value="Sumit">
</div>
<p>Dont have an account? <a href="./signup.php"> sign up </a></p>
</form>
</div>
</article>
<!-- 07/03/2023 midnight-->
<script src="./javascript/script.js"></script>
</body>
</html>