-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
53 lines (51 loc) · 2.14 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>#</title>
<?php
echo '<link rel="stylesheet" type="text/css" href="style.css">';
?>
</head>
<body>
<div class="container">
<form action="index.php" method="POST" >
<div class="form-header">
<h2>Join our community</h2>
<p class="subtitle">Take your art to the next the level.</p>
</div>
<div class="input-container">
<label for="userName" class="label">* Name:</label>
<input type="text" name="userName" placeholder="Enter your name." />
</div>
<div class="input-container">
<label for="userEmail" class="label">* Email:</label>
<input type="email" name="userEmail" placeholder="Enter your email." />
</div>
<div class="input-container">
<label for="userPassword" class="label">* Password:</label>
<input type="password" name="userPassword" placeholder="Enter password." />
</div>
<button class="#-btn" type="submit">#</button>
<p>Alredy have an account? <a href="signin.php">Signin</a></p>
</form>
</div>
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$userName = htmlspecialchars(trim($_POST['userName']));
$userEmail = htmlspecialchars(trim($_POST['userEmail']));
$userPassword = htmlspecialchars(trim($_POST['userPassword']));
if (empty($userName) || empty($userEmail) || empty($userPassword)) {
echo "All fields are required!";
} elseif (strlen($userName) < 3 || strlen($userName) > 30) {
echo "Name must be between 3 and 30 characters long!";
} elseif (strlen($userPassword) < 8 || strlen($userPassword) > 12) {
echo "Password must be between 8 and 12 characters long!";
} else {
echo "Welcome, $userName to our community!";
}
}
?>
</body>
</html>