-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount_create.php
More file actions
39 lines (36 loc) · 972 Bytes
/
Copy pathaccount_create.php
File metadata and controls
39 lines (36 loc) · 972 Bytes
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
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Get the form data
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$username = $_POST['username'];
$password = $_POST['password'];
// Generate a unique user ID
$userId = uniqid();
// Validate the form data
$errors = array();
if (empty($firstName)) {
$errors[] = 'First name is required';
}
if (empty($lastName)) {
$errors[] = 'Last name is required';
}
if (empty($username)) {
$errors[] = 'Username is required';
}
if (empty($password)) {
$errors[] = 'Password is required';
}
// If there are errors, display them to the user
if (count($errors) > 0) {
foreach ($errors as $error) {
echo '<p>' . $error . '</p>';
}
} else {
// If there are no errors, create the account
// ... (code to create account goes here)
echo '<p>Account created successfully!</p>';
echo '<p>Your user ID is: ' . $userId . '</p>';
}
}
?>