-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
108 lines (82 loc) · 3.54 KB
/
index.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
session_start();
$_SESSION['userName'] = "";
$_SESSION['userID'] = "";
require 'dbOperations/IninitalizeDB.php';
if (isset($_POST['user'])) {
$userSubmittedName = strtolower(trim($_POST['name']));
$verifyPassword = strtolower(trim($_POST['password']));
$verifyPassword = crypt($verifyPassword, "salt");
$selectUserQuery = "SELECT `id`,`username`,`password` FROM `$dataBaseName`.`Users`";
$result = mysqli_query($connection, $selectUserQuery);
if (!$result) {
consolelog("Failed To Get Data From Users Table!");
}
while ($row = mysqli_fetch_row($result)) {
$databaseUserId = $row[0];
$databaseUsername = $row[1];
$databasePassword = $row[2];
if ($databaseUsername != $userSubmittedName || $verifyPassword != $databasePassword) {
consolelog("Wrong Password Or Username!");
} else {
$_SESSION['userName'] = $databaseUsername;
$_SESSION['userID'] = $databaseUserId;
header("location: Pages/Chat.php");
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="CSS/styles.css">
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css">
<script type="text/javascript" src="../JavaScript/Main.js"></script>
<title>Talker - Login</title>
</head>
<div class="too-small">
<main class="main">
<section class="contact section" id="contact">
<h2 class="section__title">User Login</h2>
<span class="span section__subtitle">log in to continue to the website</span>
<div class="contact__container container grid">
<form id="form" action="index.php" method="POST" class="contact__form grid">
<div class="contact__inputs grid">
<div class="contact__content">
<label for="" class="contact__label"> User Name </label>
<input type="text" name="name" class="contact__input">
</div>
<div class="contact__content">
<label for="" class="contact__label"> Password </label>
<input type="password" name="password" class="contact__input">
</div>
</div>
<div class="button__group">
<button type="submit" name="user" class="button button--flex">
Log In As an User
<i class="uil uil-user button__icon"></i>
</button>
<a href="Pages/UserAuth.php" class="button button--flex">
Create A New Account
<i class="uil uil-user-plus button__icon"></i>
</a>
</div>
</form>
</div>
</section>
</main>
</div>
<div class="main resolution__text">
<section class="section">
<h2 class="section__title">Resolution Too Small</h2>
<span class="span section__subtitle">Please Swap To a Device With Bigger Resolution</span>
<span class="span section__subtitle"> Sorry for the inconvenience, I'm not getting paid enough for this<br> (I'm not getting paid at all) </span>
</section>
</div>
<script>
CheckDateForWipeOut();
</script>
</html>