-
Notifications
You must be signed in to change notification settings - Fork 1
/
emailVerify.php
executable file
·148 lines (142 loc) · 6.31 KB
/
emailVerify.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
142
143
144
145
146
147
148
<?php
ob_clean();
require_once("util.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="format-detection" content="telephone=no"/>
<meta name="keywords" content="files, images, funny pictures, image host, image upload, image sharing, image resize, file host, file upload, file sharing, email validation, user registration"/>
<meta name="description" content="Vadweb is home to the webs most popular image and video content, validate your email to enchance your user experience."/>
<meta name="copyright" content="Copyright 2014 Vadweb, SWAG."/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge;"/>
<link rel="shortcut icon" href="images/vmg.ico"/>
<link href="/resource/bootstrap/css/bootstrap.css" rel="stylesheet"/>
<link href="/resource/bootstrap/css/simpleTemp.css" rel="stylesheet">
<title>Vadweb: Registering Email Validation</title>
<?php
logGenericPageView("emailVerify.php");
?>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Vadweb</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a style="color:#FFF" href="/register.php">Register</a></li>
<li><a style="color:#FFF" href="/files.php">File Uploads</a></li>
<li><a style="color:#FFF" href="/account.php">Account Settings</a></li>
</ul>
<?php printNavBarForms("emailVerify.php"); ?>
</div><!--/.nav-collapse -->
</div>
</div>
<div class="container-fluid">
<div class="starter-template" >
<h1>Email Verification</h1>
<p class="lead" style="overflow:auto; overflow-style:marquee-block">You must verify your email before continuing</p>
<p>Due to a large number of emails used for registration being fake, we have added this step to make the user experience more secure.</p><br><br><br>
<span style='color:red; font-family: Comic Sans MS'>
<?php
if (emailVerified() === true)
{
echo "<h1>You are already verified...</h1>";
header("Refresh:3; URL=http://www.vadweb.us/");
exit();
}
if ($_SERVER['REQUEST_METHOD'] == "GET" && isset($_GET["c"]))
{
$code = $_GET["c"];
if ($code == $_SESSION['emailCode'])
{
echo "<p><h1> Success: you have successfully validated your email. You will now be redirected.</h1></p>";
header("Refresh:3; URL=http://www.vadweb.us/");
verifyEmail($_GET["em"]);
exit();
}
}
if (!isLoggedIn())
{
//echo "<h1>ERROR: You are not logged in... </h1>";
//exit();
}
if (!isset($_SESSION['emailCode']))
{
$_SESSION['emailCode'] = generateRandomLetterString(20);
emailString($_SESSION['emailCode']);
echo "<p><h2>Your email verification code has been emailed. Please follow the instructions in the email.</h2><br>You will be able to access site features once you click the link in the email.</p>";
echo "
<p>
<form class='navbar-form' role='form' action='/account.php' method='post'>
Current Email: " . getUserInfo()[2] . " <br>
<div class='form-group'>
<input type='text' placeholder='Your new email' id='email' name='email' class='form-control'>
</div>
<button type='submit' class='btn btn-success'>Change Email</button>
</form>
</p>
";
}
else
{
//click here to request another email
//button to change email if it is wrong
//timeouts for all this so cannot spam :(
emailSending2:
if (!isset($_SESSION["emailResent"]))
{
emailString($_SESSION['emailCode']);
$_SESSION["emailResent"] = time();
echo "<p><h2>Code already generated. Your email verification code has been emailed. Please follow the instructions in the email.</h2><br>You will be able to access site features once you click the link in the email.
<br>If you have not received an email, check your spam.<br><br></p>";
echo "
<p>
<form class='navbar-form' role='form' action='/account.php' method='post'>
Current Email: " . getUserInfo()[2] . " <br>
<div class='form-group'>
<input type='text' placeholder='Your new email' id='email' name='email' class='form-control'>
</div>
<button type='submit' class='btn btn-success'>Change Email</button>
</form>
</p>
";
}
else
{
if (time() > ($_SESSION["emailResent"] + 180))
{
unset($_SESSION["emailResent"]);
goto emailSending2;
}
echo "<p><h2>Warning, you just requested another email. You cannot do this too often...<br><br> Please wait " . (($_SESSION["emailResent"] + 180) - time()) .
" seconds and then refresh this page. <br> Meanwhile please double check your email (and spam).<br><br></h2></p>";
echo "
<p>
You can still change your email here: <br>
<form class='navbar-form' role='form' action='/account.php' method='post'>
Current Email: " . getUserInfo()[2] . "<br>
<div class='form-group'>
<input type='text' placeholder='Your new email' id='email' name='email' class='form-control'>
</div>
<button type='submit' class='btn btn-success'>Change Email</button>
</form>
</p>
";
}
}
?>
</span>
</div>
</div>
</body>
</html>