Location: PHPKode > projects > H-tracker > account-confirm.php
<?
//
//  H-Tracker v0.2
//    http://h-tracker.org
//    Based on TorrentTrader (http://www.torrenttrader.org)
//
//
require_once("backend/functions.php");
require_once("backend/phpbb2Bridge.php");

$id = (int)$_GET["id"];
$md5 = $_GET["secret"];

if (!$id)
	show_error_msg("Error","Thats not a valid ID!",1);

dbconn();

$res = mysql_query("SELECT password, secret, email, username, status FROM users WHERE id = $id");
$row = mysql_fetch_array($res);

if (!$row)
	show_error_msg("Error","No users found with that ID",1);

if ($row["status"] != "pending") {
	header("Refresh: 0; url=account-confirm-ok.php?type=confirmed");
	exit();
}

$sec = $row["secret"];

if ($md5 != md5($sec))
	show_error_msg("Error","There has been a problem with your activation link",1);

$newsec = mksecret();

mysql_query("UPDATE users SET secret=" . sqlesc($newsec) . ", status='confirmed' WHERE id=$id AND secret=" . sqlesc($row["secret"]) . " AND status='pending'");

if (!mysql_affected_rows())
	show_error_msg("Error","Unable to activate account please contact a admin",1);
    insert_phpBB2user($row["username"], $row["password"], $row["email"]);
    login_phpBB2user($row["username"], $row["password"], TRUE);
    logincookie($id, $row["password"], $newsec);

header("Refresh: 0; url=account-confirm-ok.php?type=confirm");
?>
Return current item: H-tracker