-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangeemail.php
34 lines (30 loc) · 1.04 KB
/
changeemail.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
<?php
include_once 'dbconnect.php';
$confirm_key = $_GET["key"];
$email = $_GET["email"];
$id = $_GET["id"];
$check = mysqli_query($con, "SELECT email FROM confirm WHERE confirm_key = '$confirm_key'");
$row=mysqli_fetch_array($check,MYSQLI_ASSOC);
if(mysqli_num_rows($check) == 1)
{
$query = mysqli_query($con, "UPDATE users SET status = 0 WHERE email = '$row[email]'");
if($query)
{
$del = mysqli_query($con, "DELETE FROM confirm WHERE confirm_key = '$confirm_key'");
if($del)
{
if(mysqli_query($con, "UPDATE users SET email = '" . $email . "' WHERE id = '".$id."' ")) {
header('Refresh: 3; url=login.php' );
$msg= "Thank You, your email is now activated. <a href='login.php'>Click here if you are not automatically redirected to login page.</a>";
echo $msg;
}
}
}
}
else
{
header('Refresh: 3; url=dob.php' );
$msg = "Sorry, your confirmation code is invalid or your email maybe be already activated. <a href='dob.php'>You will now be redirected back to the sign up page.</a>";
echo $msg;
}
?>