-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathverified.php
73 lines (61 loc) · 2.08 KB
/
verified.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
<?php
include "error.php";
if(!isset($_GET['hash'])):
echo "<h1>Error 404 page not found</h1>";
exit();
else:
$hash=$_GET['hash'];
include "classes/stmt.php";
include "classes/DBase.php";
$conn = new DBase("brokfree");
$pdo=$conn->pdo;
$arr=['hash'=>$hash,];
$sql=" SELECT email from email_verify where hash=:hash";
$stmt=new Stmt($pdo);
$stmt=$stmt->run($sql,$arr);
if($stmt->rowCount()==0):
echo "<h1>Error 404 page not found</h1>";
exit();
else:
foreach ($stmt as $row) {
$email=$row['email'];
}
$sql="DELETE FROM email_verify where hash=:hash";
$stmt=new Stmt($pdo);
$stmt->run($sql,$arr);
$sql="SELECT * FROM user_temp where email=:email;";
unset($arr);
$arr=['email'=>$email];
$stmt= new Stmt($pdo);
$stmt=$stmt->run($sql,$arr);
foreach ($stmt as $row):
$password=$row['password_hash'];
$username=$row['username'];
echo $username;
$name=$row['name'];
$mobile=$row['mobile'];
endforeach;
$sql="DELETE FROM user_temp WHERE email=:email;";
$stmt= new Stmt($pdo);
$stmt->run($sql,$arr);
unset($arr);
$arr=[
'email'=>$email,
'name'=>$name,
'password'=>$password,
'mobile'=>$mobile,
'username'=>$username,
];
$sql="INSERT INTO users SET
email= :email,
name =:name,
password_hash=:password,
mobile=:mobile,
username=:username;";
$stmt=new Stmt($pdo);
$stmt->run($sql,$arr);
$url="/brokfree/templates/thank-you.html.php";
http_response_code(301);
header("Location:".$url );
endif;
endif;