Файл: confirm.php
Строк: 47
<?php
/**
* account confirmation
*
* @package Sngine
* @author Zamblek
*/
// fetch kernal
require('kernal.php');
// check page parameters
if(!isset($_GET['id']) || $_GET['id'] == 0 || $_GET['id'] == ""){
SystemError($translate->__("Invalid Link"), $translate->__("You may have clicked an expired link or mistyped the address."));
}else {
if(!isset($_GET['code'])){
SystemError($translate->__("Invalid Link"), $translate->__("You may have clicked an expired link or mistyped the address."));
}
}
if($userExist && $user->_userArray['Verified'] == "N") {
if($userArray['UserID'] !== $_GET['id'] || $userArray['ActivationCode'] !== $_GET['code']) {
SystemError($translate->__("Invalid Link"), $translate->__("You may have clicked an expired link or mistyped the address."));
}
$updateUser = $db->query(sprintf("UPDATE users SET Verified = 'Y' WHERE UserID = %s", Secure($userArray['UserID'], 'int'))) or SQLError();
header('Location: '.SITE_URL);
}elseif($userExist && $user->_userArray['Verified'] == "Y") {
header('Location: '.SITE_URL);
}
$checkQuery = $db->query(sprintf("SELECT * FROM users WHERE UserID = %s AND ActivationCode = %s AND Verified = 'N'", Secure($_GET['id'], 'int'), Secure($_GET['code']))) or SQLError();
if($checkQuery->num_rows >= 1) {
$getUser = $checkQuery->fetch_array(MYSQL_ASSOC);
$updateUser = $db->query(sprintf("UPDATE users SET Verified = 'Y' WHERE UserID = %s", Secure($getUser['UserID'], 'int'))) or SQLError();
$user->signOut();
try {
$user->updateLastSign($getUser['UserID']);
$user->setCookies($getUser['UserID'], $remember);
}catch (Exception $e) {
SystemError("Error", $e->getMessage());
}
header('Location: '.SITE_URL);
}else {
SystemError($translate->__("Invalid Link"), $translate->__("You may have clicked an expired link or mistyped the address."));
}
?>