-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
54 lines (44 loc) · 1.38 KB
/
signup.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
<?php
include './dbconn.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST["username"];
$password = $_POST["password"];
$stmt = $conn->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
$stmt->bind_param("ss", $username, $password);
if ($stmt->execute()) {
header("Location: ./login.php");
exit();
} else {
echo "Error: " . $stmt->error;
}
$stmt->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./Style/login.css">
<link rel="shortcut icon" href="./images/favicon.png" type="image/x-icon">
<title>Sign Up</title>
</head>
<body>
<div class="container">
<h2 class="logoName">Sign Up</h2>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" id="loginForm">
<div class="form-control">
<input type="text" id="username" name="username" required>
<label for="username">Username</label>
</div>
<div class="form-control">
<input type="password" id="password" name="password" required>
<label for="password">Password</label>
</div>
<div>
<button type="submit" id="btn" value="Sign Up">Sign Up</button>
</div>
</form>
</div>
</body>
</html>