-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsignup.php
160 lines (133 loc) · 8 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<style>
.main-container {
margin: 0 !important;
padding: 0 !important;
}
</style>
</head>
<body>
<div class="container-fluid main-container">
<!-- Section: Design Block -->
<section class="text-center mb-5">
<!-- Background image -->
<div class="p-5 bg-image" style="
background : #534A4A;
height: 250px;
"></div>
<!-- Background image -->
<div class="card mx-4 mx-md-5 shadow-5-strong" style="
margin-top: -100px;
background : #d9d9d9;
backdrop-filter: blur(30px);
">
<div class="card-body py-5 px-md-5">
<div class="row d-flex justify-content-center">
<div class="col-lg-8">
<h2 class="fw-bold mb-5">Sign up now</h2>
<form action="" method="POST" enctype="multipart/form-data">
<!-- 2 column grid layout with text inputs for the first and last names -->
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<label class="form-label" for="form3Example1">First name</label>
<input type="text" id="userFName" name="userFName" class="form-control" pattern="[A-Za-z ]{1,}" required />
</div>
</div>
<div class="col-md-6 mb-4">
<div class="form-outline">
<label class="form-label" for="form3Example2">Last name</label>
<input type="text" id="userLName" name="userLName" class="form-control" pattern="[A-Za-z ]{1,}" required />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 mb-4">
<div class="form-outline">
<label class="form-label" for="form3Example3">Phone</label>
<input type="phone" id="userPhone" name="userPhone" class="form-control" pattern="[7-9]{1}[0-9]{9}" required />
</div>
</div>
<div class="col-md-6 mb-4">
<label for="gender" class="form-label">Gender</label>
<div class="radioButtons">
<input class="form-check-input" type="radio" name="userGender" value="male" checked id="flexRadioDefault1">
<label class="form-check-label me-2" for="flexRadioDefault1">
Male
</label>
<input class="form-check-input" type="radio" name="userGender" value="female">
<label class="form-check-label me-2" for="flexRadioDefault1">
Female
</label>
<input class="form-check-input" type="radio" name="userGender" value="other">
<label class="form-check-label" for="flexRadioDefault1">
Other
</label>
</div>
</div>
</div>
<!-- Email input -->
<div class="row">
<div class="col-md-6 mb-4">
<label class="form-label" for="form3Example3">Email address</label>
<input type="email" id="userEmail" name="userEmail" class="form-control" />
</div>
<!-- Password input -->
<div class="col-md-6 mb-4">
<label class="form-label" for="form3Example4">Password</label>
<input type="password" id="userPass" name="userPass" class="form-control" required />
</div>
</div>
<!-- Submit button -->
<div class="row d-flex justify-content-around">
<button type="submit" class="btn btn-primary mb-4 col-md-4" name="submit">
Sign up
</button>
<div class="signup-text mb-4 col-md-4">
<p class="mb-0">Already have an Account?</p>
<a href="login.php">Sign in</a>
</div>
</div>
</form>
<?php
require('config.php');
$tableName = "user";
if (isset($_POST['submit'])) {
$userFName = $_POST['userFName'];
$userLName = $_POST['userLName'];
$userEmail = $_POST['userEmail'];
$userPass = password_hash($_POST['userPass'], PASSWORD_DEFAULT);
$userPhone = $_POST['userPhone'];
$userGender = $_POST['userGender'];
$userStatus = 'unblocked';
$userImage = "user.png";
$q = "Insert into `user` (`UserFName`,`userLName`,`userEmail`, `userPass`, `userPhone`, `userGender`, `userStatus`, `userImage`) values ('$userFName','$userLName','$userEmail', '$userPass', '$userPhone' , '$userGender' ,'$userStatus' ,'$userImage')";
// $conn = exec($q);
$result = mysqli_query($conn, $q);
if ($result > 0) {
echo "<script> window.location.assign('login.php');</script> ";
} else {
echo "insertion failed";
echo mysqli_error($conn);
echo "<br>";
print_r($result);
}
}
?>
</div>
</div>
</div>
</div>
</section>
<!-- Section: Design Block -->
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<script src="../assets/js/validation.js"></script>
</body>
</html>