-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistration.php
More file actions
266 lines (229 loc) · 12.2 KB
/
Copy pathregistration.php
File metadata and controls
266 lines (229 loc) · 12.2 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?php
require 'inc/dynamic_session.php';
ob_start();
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'PHPMailer-master/src/Exception.php';
require 'PHPMailer-master/src/PHPMailer.php';
require 'PHPMailer-master/src/SMTP.php';
$msg = "";
if (isset($_POST['submit'])) {
$firstname = mysqli_real_escape_string($connect, $_POST['first__name']);
$lastname = mysqli_real_escape_string($connect, $_POST['last__name']);
$email = mysqli_real_escape_string($connect, $_POST['registration__email']);
$type = mysqli_real_escape_string($connect, $_POST['type']);
$password = mysqli_real_escape_string($connect, $_POST['regi__pass']);
$c_password = mysqli_real_escape_string($connect, $_POST['pass__con']);
$token = md5($firstname).rand(1000, 9999);
$date= date('d/M/Y');
if ($password != $c_password) {
$msg = "<div class='p-2 rounded text-danger text-center mb-2 mt-2'>Confirm Your Password</div>";
}
else{
$mail = mysqli_query($connect, "SELECT * FROM users WHERE email = '$email'");
if (mysqli_num_rows($mail) > 0) {
$msg = "<div class='p-2 rounded text-danger text-center mb-2 mt-2'>The Email has been registered!</div>";
}else{
$sql = "INSERT INTO users(firstname, lastname, type, email, password, token, date) VALUES ('$firstname', '$lastname', '$type', '$email', '$password', '$token', '$date')";
$query = mysqli_query($connect, $sql);
if ($query) {
$fetch = mysqli_query($connect, "SELECT * FROM users WHERE email = '$email'");
$vet = mysqli_fetch_array($fetch);
$_SESSION['identity'] = $vet['id'];
// $msg = "You have Successfully Registered. You will be Redirected in a moment.";
header('location: question_page');
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 0; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'vikhomes.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'admin@vikhomes.com'; //SMTP username
$mail->Password = ''; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('admin@vikhomes.com', 'Vikhomes');
$mail->addAddress($email, $firstname); //Add a recipient
$mail->addAddress('admin@vikhomes.com'); //Name is optional
// $mail->addReplyTo('akeemolayiwola09@gmail.com', 'Vikhomes');
// $mail->addCC('cc@example.com');
// $mail->addBCC('bcc@example.com');
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Vikhomes verification link';
$mail->Body = 'Dear <b>'. $firstname.' </b>, You are Successfully registered on vikhomes. Click on the link below to verify your account. <a href="vikhomes.com/verify?email='.$email.'&&token='.$token.'">
vikhomes.com/verify?email='.$email.'&&token='.$token.'
</a>';
$mail->AltBody = 'Dear <b>'. $firstname.' </b>, You are Successfully registered on vikhomes. Click on the link below to verify your account. <a href="vikhomes.com/verify?email='.$email.'&&token='.$token.'">
vikhomes.com/verify?email='.$email.'&&token='.$token.'
</a>';
$mail->send();
// echo 'Message has been sent';
}
catch (Exception $e) {
$msg = "Message could not be sent. Ensure that your email is properly typed. Mailer Error: {$mail->ErrorInfo}";
}
}
}
}
}
// <script>setTimeout(function(){window.location='index-three'}, 3000)</script>
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<?php require 'inc/toplink.php' ?>
</head>
<body>
<div class="wrapper bg__img" data-background="./assets/images/registration-bg.png">
<!-- ==== header start ==== -->
<header class="header header--secondary">
<nav class="navbar navbar-expand-xl">
<div class="container">
<a class="navbar-brand" href="index">
<img src="assets/images/team/<?php
$s= mysqli_query($connect, "SELECT image FROM users WHERE level = 1");
$r = mysqli_fetch_array($s);
echo $r['image'];
?>" alt="Logo" class="logo" />
</a>
<div class="navbar__out order-2 order-xl-3">
<div class="nav__group__btn">
<a href="login" class="log d-none d-sm-block"> Log In </a>
<a href="registration" class="button button--effect d-none d-sm-block"> Join Now <i
class="fa-solid fa-arrow-right-long"></i> </a>
</div>
<button class="navbar-toggler d-block d-sm-none" type="button" data-bs-toggle="collapse"
data-bs-target="#primaryNav" aria-controls="primaryNav" aria-expanded="false"
aria-label="Toggle Primary Nav">
<span class="icon-bar top-bar"></span>
<span class="icon-bar middle-bar"></span>
<span class="icon-bar bottom-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse order-3 order-xl-2" id="primaryNav">
<ul class="navbar-nav">
<li class="nav-item d-block d-sm-none">
<a href="login" class="nav-link">Log In</a>
</li>
<li class="nav-item d-block d-sm-none">
<a href="registration" class="button button--effect button--last">Join Now <i
class="fa-solid fa-arrow-right-long"></i></a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!-- ==== #header end ==== -->
<!-- ==== registration section start ==== -->
<section class="registration clear__top">
<div class="container">
<div class="registration__area">
<h4 class="neutral-top">Registration</h4>
<p class="text-center">
<?php echo $msg; ?>
</p>
<p>Already Registered? <a href="login">Login</a></p>
<form method="post" name="registration__form" enctype="multipart/form-data">
<div class="regi__type">
<label for="typeSelect">You are?</label>
<select class="type__select" name="type" id="typeSelect">
<option value="particular">Particular</option>
<option value="individual">Individual</option>
</select>
</div>
<div class="row">
<div class="col-sm-6">
<div class="input input--secondary">
<label for="firstName">First Name*</label>
<input type="text" name="first__name" id="firstName" placeholder="First Name"
required="required" />
</div>
</div>
<div class="col-sm-6">
<div class="input input--secondary">
<label for="lastName">Last Name*</label>
<input type="text" name="last__name" id="lastName" placeholder="Last Name"
required="required" />
</div>
</div>
</div>
<div class="input input--secondary">
<label for="registrationMail">Email*</label>
<input type="email" name="registration__email" id="registrationMail"
placeholder="Enter your email" required="required" />
</div>
<div class="row">
<div class="col-sm-6">
<div class="input input--secondary">
<label for="regiPass">Password*</label>
<input type="password" name="regi__pass" id="regiPass" placeholder="Password"
required="required" />
</div>
</div>
<div class="col-sm-6">
<div class="input input--secondary">
<label for="passCon">Password Confirmation*</label>
<input type="password" minlength="6" name="pass__con" id="passCon" placeholder="Password Confirm"
required="required" />
</div>
</div>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="condtion" name="accept__condition" value="agree" />
<span class="checkmark"></span>
I have read and I agree to the <a href="key-risks">
Privacy Policy</a>
</label>
</div>
<div class="input__button">
<button type="submit" name="submit" class="button button--effect">Create My Account</button>
</div>
</form>
</div>
</div>
</section>
<!-- ==== #registration section end ==== -->
<!-- Scroll To Top -->
<a href="javascript:void(0)" class="scrollToTop">
<i class="fa-solid fa-angles-up"></i>
</a>
</div>
<!-- ==== js dependencies start ==== -->
<!-- jquery -->
<script src="assets/vendor/jquery/jquery-3.6.0.min.js"></script>
<!-- bootstrap five js -->
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- nice select js -->
<script src="assets/vendor/nice-select/js/jquery.nice-select.min.js"></script>
<!-- magnific popup js -->
<script src="assets/vendor/magnific-popup/js/jquery.magnific-popup.min.js"></script>
<!-- slick js -->
<script src="assets/vendor/slick/js/slick.js"></script>
<!-- shuffle js -->
<script src="assets/vendor/shuffle/shuffle.min.js"></script>
<!-- jquery downcount timer -->
<script src="assets/vendor/downcount/jquery.downCount.js"></script>
<!-- waypoints js -->
<script src="assets/vendor/waypoints-js/jquery.waypoints.min.js"></script>
<!-- counter up js -->
<script src="assets/vendor/counter-js/jquery.counterup.min.js"></script>
<!-- apex chart js -->
<script src="assets/vendor/apex-chart/apexcharts.min.js"></script>
<!-- wow js -->
<script src="assets/vendor/wow/wow.min.js"></script>
<!-- ==== js dependencies end ==== -->
<!-- plugin js -->
<script src="assets/js/plugin.js"></script>
<!-- main js -->
<script src="assets/js/main.js"></script>
</body>
</html>