-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
171 lines (149 loc) · 7.32 KB
/
signup.php
File metadata and controls
171 lines (149 loc) · 7.32 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign Up - Juliet</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="stylesheet" href="css/signup.css">
</head>
<body>
<div class="juliet-container">
<div class="juliet-logo">
<!-- Replace with your logo -->
<img src="images/logo.png" alt="Juliet Logo">
</div>
<?php if (isset($_SESSION['signup_error'])): ?>
<div class="juliet-alert juliet-alert-error">
<i class="fas fa-exclamation-circle"></i> <?php echo htmlspecialchars($_SESSION['signup_error']); ?>
</div>
<?php unset($_SESSION['signup_error']); ?>
<?php endif; ?>
<form class="juliet-signup-form" action="signup-process.php" method="POST" id="signupForm">
<h2>Create an Account</h2>
<div class="juliet-form-group">
<label for="full_name">Full Name</label>
<div class="juliet-input-with-icon">
<i class="fas fa-user"></i>
<input type="text" id="full_name" name="full_name" required
value="<?php echo isset($_SESSION['form_data']['full_name']) ? htmlspecialchars($_SESSION['form_data']['full_name']) : ''; ?>">
</div>
</div>
<div class="juliet-form-group">
<label for="phone_number">Phone Number</label>
<div class="juliet-input-with-icon">
<i class="fas fa-phone"></i>
<input type="tel" id="phone_number" name="phone_number" required
value="<?php echo isset($_SESSION['form_data']['phone_number']) ? htmlspecialchars($_SESSION['form_data']['phone_number']) : ''; ?>">
</div>
<small>Format: 10-15 digits (no spaces or special characters)</small>
</div>
<div class="juliet-form-group">
<label for="email">Email</label>
<div class="juliet-input-with-icon">
<i class="fas fa-envelope"></i>
<input type="email" id="email" name="email" required
value="<?php echo isset($_SESSION['form_data']['email']) ? htmlspecialchars($_SESSION['form_data']['email']) : ''; ?>">
</div>
<small>We'll never share your email with anyone else.</small>
</div>
<div class="juliet-form-group">
<label for="national_id">National ID</label>
<div class="juliet-input-with-icon">
<i class="fas fa-id-card"></i>
<input type="text" id="national_id" name="national_id" required
value="<?php echo isset($_SESSION['form_data']['national_id']) ? htmlspecialchars($_SESSION['form_data']['national_id']) : ''; ?>">
</div>
<small>Your unique National ID number</small>
</div>
<div class="juliet-form-group">
<label for="password">Password</label>
<div class="juliet-input-with-icon">
<i class="fas fa-lock"></i>
<input type="password" id="password" name="password" required>
</div>
<div class="juliet-password-strength" id="passwordStrength">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<small>Must be at least 8 characters with uppercase, number, and special character</small>
</div>
<div class="juliet-form-group">
<label for="confirm_password">Confirm Password</label>
<div class="juliet-input-with-icon">
<i class="fas fa-lock"></i>
<input type="password" id="confirm_password" name="confirm_password" required>
</div>
<small id="passwordMatchText"></small>
</div>
<div class="juliet-terms-checkbox">
<input type="checkbox" id="terms" name="terms" required>
<label for="terms">
I agree to the <a href="terms.php" target="_blank">Terms and Conditions</a> and <a href="privacy.php" target="_blank">Privacy Policy</a>
</label>
</div>
<div class="juliet-form-group">
<button type="submit" class="juliet-continue-button">Create Account</button>
</div>
</form>
<div class="juliet-login-link">
Already have an account? <a href="login.php">Log in</a>
</div>
</div>
<script>
// Password strength indicator
const passwordInput = document.getElementById('password');
const passwordStrength = document.getElementById('passwordStrength');
const strengthSpans = passwordStrength.querySelectorAll('span');
passwordInput.addEventListener('input', function() {
const password = this.value;
let strength = 0;
// Length check
if (password.length >= 8) strength++;
if (password.length >= 12) strength++;
// Complexity checks
if (/[A-Z]/.test(password)) strength++;
if (/[0-9]/.test(password)) strength++;
if (/[^A-Za-z0-9]/.test(password)) strength++;
// Update visual indicator
strengthSpans.forEach((span, index) => {
span.classList.toggle('active', index < strength);
});
});
// Password match checker
const confirmPasswordInput = document.getElementById('confirm_password');
const passwordMatchText = document.getElementById('passwordMatchText');
function checkPasswordMatch() {
if (passwordInput.value && confirmPasswordInput.value) {
if (passwordInput.value === confirmPasswordInput.value) {
passwordMatchText.textContent = "Passwords match!";
passwordMatchText.style.color = "green";
} else {
passwordMatchText.textContent = "Passwords do not match!";
passwordMatchText.style.color = "red";
}
} else {
passwordMatchText.textContent = "";
}
}
passwordInput.addEventListener('input', checkPasswordMatch);
confirmPasswordInput.addEventListener('input', checkPasswordMatch);
// Form validation
document.getElementById('signupForm').addEventListener('submit', function(e) {
if (!document.getElementById('terms').checked) {
e.preventDefault();
alert('You must agree to the terms and conditions.');
}
});
</script>
<?php
// Clear form data from session after displaying it
if (isset($_SESSION['form_data'])) {
unset($_SESSION['form_data']);
}
?>
</body>
</html>