-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadminactivate.php
141 lines (132 loc) · 4.39 KB
/
adminactivate.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
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
<?php
require "assets/db.php";
require "assets/varnames.php";
require 'assets/sharedComponents.php';
$components = new SharedComponents();
include 'includes/header.php';
include 'includes/navbar.php';
if(isset($_GET["userid"]) && isset($_GET["code"]))
{
$id = $components->unprotect($_GET["userid"]);
$sql = "SELECT * FROM author WHERE author_id = :author_id";
if ($stmt = $pdo->prepare($sql))
{
$stmt->bindParam(":author_id", $id, PDO::PARAM_STR);
if ($stmt->execute())
{
if ($stmt->rowCount() == 1)
{
if ($row = $stmt->fetch())
{
$userstatus = $row["userstatus"];
$code = $row["code"];
if($row["userstatus"] == 1)
{
$displayoutput = displayoutput(0, "Account has been Verified already");
}
else
{
// update userstatus
$bsql = "UPDATE author SET userstatus=:userstatus WHERE author_id=:author_id";
$stmt= $pdo->prepare($bsql);
$stmt->execute(['userstatus' => 1, 'author_id' => $id]);
if ($stmt->rowCount()) {
$displayoutput = displayoutput(true, "Account Verfication Successful");
}
else
{
$displayoutput = displayoutput(false, "Verification Error");
}
//return $stmt->rowCount() ? 1 : 0;
}
}
else
{
$displayoutput = displayoutput(false, "Error Getting Details");
}
}
else {
$displayoutput = displayoutput(false, "Invalid Code or User Indentification");
}
}
else {
$accountverify = 2;
}
unset($stmt);
}
unset($pdo);
}
else
{
$displayoutput = displayoutput(false, "Invalid Code or User Indentification");
}
function displayoutput($status, $txt)
{
if($status == false)
{
return "
<div class='alert alert-danger'>
<h4>Error!</h4>
".$txt."
</div>
<p> <a href='' style='font-weight:bold;'>Try Again</a> <br> You may <a href='signup.php' style='font-weight:bold;'>Signup</a> or back to <a href='./' style='font-weight:bold;'>Homepage</a>.</p>
";
}
else if($status == true)
{
return "
<div class='alert alert-success'>
<h4>Success!</h4>
".$txt."
</div>
<p>You may <a href='login.php' style='font-weight:bold;'>Login</a> or Go back to <a href='./' style='font-weight:bold;'>Homepage</a>.</p>
";
}
else
{
return "
<div class='alert alert-secondary'>
<h4>Success!</h4>
".$txt."
</div>
<p>You may <a href='login.php' style='font-weight:bold;'>Login</a> or Go back to <a href='./' style='font-weight:bold;'>Homepage</a>.</p>
";
}
}
?>
<!--section-heading-->
<div class="section-heading " >
<div class="container-fluid">
<div class="section-heading-2">
<div class="row">
<div class="col-lg-12">
<div class="section-heading-2-title ">
<h1> <?= $globalname ?> - Activate Account</h1>
<p class="links"><a href="./">Home <i class="las la-angle-right"></i></a> Activate Account</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- display output-->
<section class="blog-author mt-30">
<div class="container-fluid">
<div class="">
<!--content-->
<div class="" style="justify-content: center; display: flex;">
<div class="row theiaStickySidebar">
<div class="card p-2">
<?= $displayoutput ?>
</div>
</div>
<br>
</div>
<!--/-->
<br>
</div>
</div>
</section>
<?php
include 'includes/footer.php';
?>