-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
136 lines (118 loc) · 4.67 KB
/
signup.php
File metadata and controls
136 lines (118 loc) · 4.67 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
require 'config.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$full_name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirm_password = $_POST['confirm_password'];
if ($password !== $confirm_password) {
$error_message = "The passwords don't match !";
} else {
$sql = "SELECT * FROM users WHERE email = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$email]);
$user = $stmt->fetch();
if ($user) {
$error_message = "This email is already in use !";
} else {
$hashed_password = password_hash($password, PASSWORD_BCRYPT);
$sql = "INSERT INTO users (full_name, email, password) VALUES (?, ?, ?)";
$stmt = $pdo->prepare($sql);
if ($stmt->execute([$full_name, $email, $hashed_password])) {
header("Location: login.php");
exit;
} else {
$error_message = "Registration error !";
}
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register - Project Name</title>
<link rel="stylesheet" href="styles.css">
<script src="https://unpkg.com/lucide@latest"></script>
</head>
<body>
<div class="auth-container">
<div class="logo">
<i data-lucide="triangle"></i>
</div>
<h1 class="auth-title">Create account</h1>
<p class="auth-subtitle">Sign up to get started with ProjectHub.</p>
<div class="auth-tabs">
<a href="login.php" class="auth-tab">
<i data-lucide="log-in" style="width: 18px; height: 18px;"></i>
Sign in
</a>
<a href="#" class="auth-tab active">
<i data-lucide="user-plus" style="width: 18px; height: 18px;"></i>
Sign up
</a>
</div>
<form method="POST" action="signup.php">
<?php if (!empty($error_message)): ?>
<div class="error-message" style="color: red; margin-bottom: 1rem;">
<?= htmlspecialchars($error_message); ?>
</div>
<?php endif; ?>
<div class="form-group">
<i data-lucide="user" style="width: 20px; height: 20px;"></i>
<div style="flex: 1;">
<div class="form-label">Full Name</div>
<input type="text" name="name" class="form-input" placeholder="Enter your full name" required>
</div>
</div>
<div class="form-group">
<i data-lucide="mail" style="width: 20px; height: 20px;"></i>
<div style="flex: 1;">
<div class="form-label">Email</div>
<input type="email" name="email" class="form-input" placeholder="Enter your email" required>
</div>
</div>
<div class="form-group">
<i data-lucide="lock" style="width: 20px; height: 20px;"></i>
<div style="flex: 1;">
<div class="form-label">Password</div>
<input type="password" name="password" class="form-input" placeholder="Choose a password" required>
</div>
</div>
<div class="form-group">
<i data-lucide="lock" style="width: 20px; height: 20px;"></i>
<div style="flex: 1;">
<div class="form-label">Confirm Password</div>
<input type="password" name="confirm_password" class="form-input" placeholder="Confirm your password" required>
</div>
</div>
<button type="submit" class="btn">
Create account
<i data-lucide="arrow-right" style="width: 18px; height: 18px;"></i>
</button>
</form>
<div class="help-text">
Need help? <a href="#">Contact support</a>
</div>
<div class="auth-footer">
<a href="#"><i data-lucide="discord" style="width: 24px; height: 24px;"></i></a>
<a href="#"><i data-lucide="globe" style="width: 24px; height: 24px;"></i></a>
</div>
<footer class="footer">
<div class="footer-content">
<p>© 2024 Project Name. All rights reserved.</p>
<div class="footer-links">
<a href="#">Privacy Policy</a>
<a href="#">Terms of Service</a>
<a href="#">Contact</a>
</div>
</div>
</footer>
</div>
<script>
lucide.createIcons()
</script>
</body>
</html>