-
Notifications
You must be signed in to change notification settings - Fork 0
/
u_email_verification.php
45 lines (38 loc) · 1.48 KB
/
u_email_verification.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
<html>
<head>
<title>Verification</title>
<link rel="stylesheet" href="css/u_email_verification.css">
</head>
<body>
<div class="main_uv">
<div class="form_uv">
<form method="POST">
<div class="uv_h2">
<h2>User Email Verification</h2></div>
<input type="hidden" name="email" value="<?php echo $_GET['email']; ?>" required>
<input type="text" name="verification_code" class="form_ip_uv" placeholder="Enter verification code" required /><br><br>
<button type="submit" name="verify_email" class="registerbtn_uv">Verify Email</button>
</form>
</div>
</div>
</body>
</html>
<?php
if (isset($_POST["verify_email"]))
{
$email = $_POST["email"];
$verification_code = $_POST["verification_code"];
// connect with database
$conn = mysqli_connect("localhost", "root", "", "swapshop_next");
// mark email as verified
$sql = "UPDATE user_data SET email_verified_at = NOW() WHERE email = '$email' AND verification_code = '$verification_code'";
$result = mysqli_query($conn, $sql);
if (mysqli_affected_rows($conn) == 0)
{
die("Incorrect Verification code <br> Try to add correct code.");
}
echo '<script type="text/javascript"> alert("Registered succesfully!")</script>';
Header('Location:login_page.php');
exit();
}
?>