-
Notifications
You must be signed in to change notification settings - Fork 2
/
confirm.php
37 lines (28 loc) · 885 Bytes
/
confirm.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
<?php
require_once("include/bittorrent.php");
$id = 0 + $_GET["id"];
$md5 = $_GET["secret"];
if (!$id)
httperr();
$res = sql_query("SELECT passhash, editsecret, status FROM users WHERE id = ".sqlesc($id));
$row = mysql_fetch_array($res);
if (!$row)
httperr();
if ($row["status"] != "pending") {
header("Refresh: 0; url=page.php?type=ok&typeok=confirmed");
exit();
}
$sec = hash_pad($row["editsecret"]);
if ($md5 != md5($sec))
httperr();
sql_query("UPDATE users SET status='confirmed', editsecret='' WHERE id=".sqlesc($id)." AND status='pending'");
if (!mysql_affected_rows())
httperr();
global $sechash;
if ($securelogin == "yes")
logincookie($id, md5($row["passhash"].$sechash),1,0x7fffffff,true);
else
logincookie($id, md5($row["passhash"].$sechash));
sessioncookie($id, md5($row["passhash"].$sechash));
header("Refresh: 0; url=page.php?type=ok&typeok=confirm");
?>