-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
executable file
·76 lines (73 loc) · 2.92 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
<?php
session_start();
if (isset($_SESSION['user_id'])) {
header('Location: redirect.php');
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login/Register</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<div class="form signin">
<h2>Login</h2>
<form action="login_process.php" method="POST">
<div class="inputBox">
<input type="text" name="username" required
pattern="^[a-zA-Z0-9]{3,20}$" title="Username must be 3-20 characters, letters and numbers only.">
<span>Username</span>
<i class="icon">👤</i>
</div>
<div class="inputBox">
<input type="password" name="password" required
pattern=".{6,}" title="Password must be at least 6 characters long.">
<span>Password</span>
<i class="icon">🔒</i>
</div>
<input type="submit" value="Login">
</form>
<p>Don't have an account? <a href="#" onclick="toggleForm()">Register</a></p>
</div>
<div class="form signup">
<h2>Register</h2>
<form action="register_process.php" method="POST">
<div class="inputBox">
<input type="text" name="username" required
pattern="^[a-zA-Z0-9]{3,20}$" title="Username must be 3-20 characters, letters and numbers only.">
<span>Username</span>
<i class="icon">👤</i>
</div>
<div class="inputBox">
<input type="email" name="email" required>
<span>Email</span>
<i class="icon">📧</i>
</div>
<div class="inputBox">
<input
type="password"
name="password"
required
pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{6,}"
title="Password must be at least 6 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character.">
<span>Password</span>
<i class="icon">🔒</i>
</div>
<input type="submit" value="Register">
</form>
<p>Already have an account? <a href="#" onclick="toggleForm()">Login</a></p>
</div>
</div>
<script>
function toggleForm() {
const container = document.querySelector('.container');
container.classList.toggle('signinForm');
}
</script>
</body>
</html>