-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
154 lines (79 loc) · 3.14 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
<?php
require "partials/header.php";
require "partials/navbar.php";
?>
<?php
// signup logic
require "config/config.php";
if (isset($_POST['signup_btn'])) {
$username = $_POST['email'];
$password = md5($_POST['password']);
if (!empty(trim($username))) { // sql to insert data into db
if (true) {
$signup_query = "INSERT INTO `signup_info`(`email`, `password`) VALUES ('[$username]','[$password]')";
$result = mysqli_query($conn, $signup_query);
if (!$result) {
echo '
<div class= "container alert-message">
<div class="alert alert-danger alert-dismissible fade show">
<strong>Username Taken!</strong> Choose a different username
</div>
</div>
';
}
else
{
header('Location:login.php');
die();
}
}
}
// username empty check
else {
echo '
<div class= "container">
<div class="alert alert-danger alert-dismissible fade show">
<strong>Username Empty!</strong> Check your username
</div>
</div>
';
}
}
?>
<!-- setting header and navbars -->
<div class="container d-flex justify-content-center pt-4 mt-4">
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="login-form-elements">
<!-- heading -->
<h1 class="display-4 font-weight-bold font-italic ">
Signup Today
</h1>
<p>
Enjoy the best ever return rates.
</p>
<div class="form pt-4">
<form action="signup.php" method="POST">
<input type="email" required name="email" id="username" placeholder="Email">
<input type="password" required name="password" id="password" placeholder="Password">
<div class="pt-3" id="privacy"><a href="#">Privacy</a>
& <a href="#"> Terms of Service</a>
</div>
<button name="signup_btn" class=" btn mt-4 signup-btn" type="submit">
Signup
</button>
</form>
</div>
</div>
</div>
<div class="col-lg-6 ">
<img id="form-image"
src="https://images.unsplash.com/photo-1527903789995-dc8ad2ad6de0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=820&q=80"
alt="abstract">
</div>
</div>
</div>
</div>
<?php require "partials/footer.php";
?>