-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathverify_acc.php
91 lines (90 loc) · 3.91 KB
/
verify_acc.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
<?php
if(!isset($_GET['token'])){
// redirect them to your desired location
header('location:err404.php');
exit;
}
require_once("database/dbconn.php");
$db = new Database();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verify Account | MK ELearn</title>
<link rel="stylesheet" href="css/all.css">
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" href="css/verifyAcc.css">
</head>
<body>
<!-- Header Section Start -->
<?php include_once('inc/header.php') ?>
<!-- Header Section End -->
<div class="bdy">
<?php
$token = isset($_GET['token']) ? $_GET['token'] : false;
$type = isset($_GET['type']) ? $_GET['type'] : false;
$cmn_msg = "<div class='dv1'>
<div class='div12'>Account Already Verified!</div>
<div class='div13'>Go To <a href='./'>HomePage</a></div>
</div>";
if($token){
if($db->select('user_verify','uname,uemail,upassword,status',null,"token = '$token'")){
$em = $db->getResult();
$uname = $em[0]['uname'];
$uemail = $em[0]['uemail'];
$upassword = $em[0]['upassword'];
$status = $em[0]['status'];
if($status == 0){
if($type){
if($type == 'user'){
if($db->update('user_verify','status=1',"token = '$token'")){
if($db->insert('user_data',['uname'=>$uname,'uemail'=>$uemail,'upassword'=>$upassword,])){
echo "<div class='dv1'>
<div class='div12'>Account Verified Successfully!</div>
</div>";
echo "<script>
setTimeout(()=>{
window.location.href='student/';
},2000);
</script>";
}
}
}else if($type == 'instructor'){
if($db->update('user_verify','status=1',"token = '$token'")){
if($db->insert('instructor_data',['iname'=>$uname,'iemail'=>$uemail,'ipass'=>$upassword,])){
echo "<div class='dv1'>
<div class='div12'>Account Verified Successfully!</div>
</div>";
echo "<script>
setTimeout(()=>{
window.location.href='instructor/login';
},2000);
</script>";
}
}
}else{
echo $cmn_msg;
}
}else{
echo $cmn_msg;
}
}else if($status == 1){
echo $cmn_msg;
}else{
echo $cmn_msg;
}
}else{
echo $cmn_msg;
}
}else{
echo $cmn_msg;
}
?>
</div>
<!-- Footer Section Start -->
<?php include_once('inc/footer.php') ?>
<!-- Footer Section End -->
</body>
</html>