forked from mlangill/biotorrents
-
Notifications
You must be signed in to change notification settings - Fork 0
/
confirm.php
40 lines (26 loc) · 807 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
38
39
40
<?php
require_once "include/bittorrent.php";
require_once "include/user_functions.php";
$id = $_GET["id"];
//$id = (int)$_GET["id"];
$md5 = $_GET["secret"];
if (!is_valid_id($id))
httperr();
dbconn();
$res = mysql_query("SELECT passhash, editsecret, status FROM users WHERE id = $id");
$row = mysql_fetch_assoc($res);
if (!$row)
httperr();
if ($row["status"] != "pending") {
header("Refresh: 0; url=$BASEURL/ok.php?type=confirmed");
exit();
}
$sec = hash_pad($row["editsecret"]);
if ($md5 != md5($sec))
httperr();
mysql_query("UPDATE users SET status='confirmed', editsecret='' WHERE id=$id AND status='pending'");
if (!mysql_affected_rows())
httperr();
logincookie($id, $row["passhash"]);
header("Refresh: 0; url=$BASEURL/ok.php?type=confirm");
?>