-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify.php
85 lines (77 loc) · 2.7 KB
/
verify.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
<?php
include_once ('config/session.php');
include_once ('config/database.php');
include_once 'error_checking.php';
if (isset($_POST["verify"]) && !empty($_POST["link"]))
{
$link = htmlEntities($_POST["link"]);
$username = htmlEntities($_POST["username"]);
$hash = htmlEntities($_GET["q"]);
$query = $db->prepare('SELECT link FROM users WHERE username = :username');
$query->execute(array(':username' => $username));
$linkExists = $query->fetch(PDO::FETCH_ASSOC);
$link_check = $linkExists['link'];
if ($link_check != $link)
{
$result = "<p style='color: red;'>Your password reset key is invalid.<\p>";
}
else {
$query = $db->prepare("UPDATE users SET active = '1' WHERE link = :link");
$query->execute(array(':link' => $link));
$result = "<p style='color: green;'>Account is now active</p>";
}
}
?>
<html>
<header>
<link rel="stylesheet" type="text/css" href="style/style.css" />
<title>Account Activation Page</title>
<meta charset="utf-8">
<title>Camaguru</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style/styles.css">
<link href="https://fonts.googleapis.com/css?family=Muli%7CRoboto:400,300,500,700,900" rel="stylesheet"></head>
<body>
<div class="main-nav">
<ul class="nav">
<li class="name">CAMAGURU</li>
<li><a href="registration.php">Register</a></li>
<li><a href="gallery.php">Gallery</a></li>
<?php include_once('loga.php');?>
<?php include_once('logb.php');?>
</ul>
</div>
<header>
<nav>
<div class="main-wrapper">
</div>
</nav>
</header>
<link rel="stylesheet" type="text/css" href="style/style.css" />
<title>Account Activation Page</title>
</head>
<nav>
<div class="main-wrapper">
</div>
</header>
<center><div class="mainC">
<h1>Account Activation</h1>
<?php if(isset($result)) echo "<b>$result <b>" ?>
<?php if(!empty($form_errors)) echo show_errors($form_errors); ?>
<?php echo '
<form class="Regform" action="" method="POST">
Username<br>
<input type="text" name="username" placehoder="username">
<br>
Enter key sent to your in email<br>
<input type="text" name="link" placehoder="E-mail">
<br><br>
<input type="hidden" name="q" value="';
if (isset($_GET["q"])) {
echo $_GET["q"];
}
echo '" /><input style="margin: 10px;" type="submit" name="verify" value=" Verify Activation " /></form>';
?>
</div></center>
</body>
</html>