-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.php
More file actions
61 lines (49 loc) · 1.79 KB
/
Copy pathsignup.php
File metadata and controls
61 lines (49 loc) · 1.79 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
<?php
require 'models/db.php';
$message = '';
class signup extends db{
private function sig(){
if (!empty($_POST['email']) && !empty($_POST['password'])) {
$sql = "INSERT INTO admins (email, password, family, name, date) VALUES (:email, :password :family, :name, :date)";
$stmt = $connect->prepare($sql);
$stmt->bindParam(':email', $_POST['email']);
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);
$stmt->bindParam(':password', $password);
$stmt->bindParam(':family', $_POST['family']);
$stmt->bindParam(':name', $_POST['name']);
$stmt->bindParam(':date', $_POST['date']);
if ($stmt->execute()) {
$message = 'Successfully created new user';
} else {
$message = 'Sorry there must have been an issue creating your account';
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SignUp</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php require 'partials/header.php' ?>
<?php if(!empty($message)): ?>
<p> <?= $message; ?></p>
<?php endif; ?>
<h1>SignUp</h1>
<span>or <a href="login.php">Login</a></span>
<form action="signup.php" method="POST">
<input name="name" type="text" placeholder="Enter your name">
<input name="family" type="text" placeholder="Enter your family name">
<input name="date" type="text" placeholder="Enter your date">
<input name="email" type="text" placeholder="Enter your email">
<input name="password" type="password" placeholder="Enter your Password">
<input name="confirm_password" type="password" placeholder="Confirm Password">
<input type="submit" value="Submit">
</form>
</body>
</html>