<?php
/**
 * @version $Id: activate.php v2.0 $
 * @package PBDigg
 * @copyright Copyright (C) 2007 - 2008 PBDigg.com. All Rights Reserved.
 * @license PBDigg is free software and use is subject to license terms
 */

define('PB_CSCRIPT', 'activate');
require_once('include/common.inc.php');

$code = trim($_GET['code']);
if ($code)
{
	$code = explode('|', PDecode($code, $pb_sitehash));
	$uid = (int)$code[0];
	$regtime = (int)$code[1];
	$rs = $DB->db_fetch_one_array("SELECT COUNT(*) num FROM {$db_prefix}members WHERE uid = $uid AND regdate = $regtime AND groupid = 6");
	if ($rs['num'])
	{
		$DB->db_query("UPDATE {$db_prefix}members SET groupid = -1 WHERE uid = $uid AND groupid = 6");
		showMsg($u_message['activate_success'], $_PBENV['PB_URL']);
	}
	else
	{
		showMsg($u_message['activate_failed'], $_PBENV['PB_URL']);
	}
}
else
{
	showMsg($u_message['activate_code_empty'], $_PBENV['PB_URL']);
}
?>
