-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
56 lines (48 loc) · 1.94 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
<?php
require_once("includes/config.php");
require_once("includes/classes/FormSanitizer.php");
require_once("includes/classes/Constants.php");
require_once("includes/classes/Account.php");
$account = new Account($con);
if(isset($_POST["submitButton"])) {
$username = FormSanitizer::sanitizeFormUsername($_POST["username"]);
$password = FormSanitizer::sanitizeFormPassword($_POST["password"]);
$sucess = $account->login($username, $password);
if($sucess) {
$_SESSION["userLoggedIn"] = $username;
header("Location: index.php");
}
}
function getInputValue($name) {
if(isset($_POST[$name])) {
echo $_POST[$name];
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>SCIENCINE</title>
<link rel="stylesheet" type="text/css" href="assets/style/style.css" />
</head>
<body>
<div class="singInConteiner">
<div class="paper">
<div class="column">
<div class="header">
<img src="assets/images/logo.png" title="Netflix Clone" alt="Site Logo" />
<h3>Sign in</h3>
<span>To continue to ScienCine</span>
</div>
<form method="POST" action="">
<?php echo $account->getError(Constants::$loginFailed); ?>
<input type="text" name="username" placeholder="Username" value="<?php getInputValue("username"); ?>" required>
<input type="password" name="password" placeholder="Password" required>
<input type="submit" name="submitButton" value="SUBMIT">
</form>
<a href="register.php" class="signInMessage">Need an account? Sign up in here!</a>
</div>
</div>
</div>
</body>
</html>