CONTROL_REG::ctl_confirm PHP Method

ctl_confirm() public method

public ctl_confirm ( )
    function ctl_confirm()
    {
        $_num_verifyId = fn_getSafe(fn_get("verify_id"), "int", 0);
        $_str_verifyToken = fn_getSafe(fn_get("verify_token"), "txt", "");
        if ($_num_verifyId < 1) {
            return array("alert" => "x120201");
        }
        if (!$_str_verifyToken) {
            return array("alert" => "x120202");
        }
        $_arr_verifyRow = $this->mdl_verify->mdl_read($_num_verifyId);
        if ($_arr_verifyRow["alert"] != "y120102") {
            return $_arr_verifyRow;
        }
        if ($_arr_verifyRow["verify_status"] != "enable") {
            return array("alert" => "x120203");
        }
        if ($_arr_verifyRow["verify_token_expire"] < time()) {
            return array("alert" => "x120204");
        }
        if (fn_baigoEncrypt($_arr_verifyRow["verify_token"], $_arr_verifyRow["verify_rand"]) != $_str_verifyToken) {
            return array("alert" => "x120205");
        }
        $_arr_userRow = $this->mdl_user->mdl_read($_arr_verifyRow["verify_user_id"]);
        if ($_arr_userRow["alert"] != "y010102") {
            return $_arr_userRow;
        }
        $_arr_verifyRow["verify_token"] = $_str_verifyToken;
        $_arr_tplData = array("userRow" => $_arr_userRow, "verifyRow" => $_arr_verifyRow);
        $this->obj_tpl->tplDisplay("reg_confirm.tpl", $_arr_tplData);
        return array("alert" => "y010102");
    }

Usage Example

Example #1
0
//不能非法包含或直接执行
if (!defined("IN_BAIGO")) {
    exit("Access Denied");
}
include_once BG_PATH_FUNC . "init.func.php";
//初始化
$arr_set = array("base" => true, "ssin" => true, "header" => "Content-Type: text/html; charset=utf-8", "db" => true, "type" => "ctl");
fn_init($arr_set);
include_once BG_PATH_INC . "is_install.inc.php";
//验证是否已安装
include_once BG_PATH_CONTROL . "user/ctl/reg.class.php";
//载入注册控制器
$ctl_reg = new CONTROL_REG();
switch ($GLOBALS["act_get"]) {
    case "confirm":
        $arr_regRow = $ctl_reg->ctl_confirm();
        //激活
        if ($arr_regRow["alert"] != "y010102") {
            header("Location: " . BG_URL_USER . "ctl.php?mod=reg&act_get=form&alert=" . $arr_regRow["alert"]);
            exit;
        }
        break;
    case "forgot":
        $arr_regRow = $ctl_reg->ctl_forgot();
        //忘记密码
        if ($arr_regRow["alert"] != "y010102") {
            header("Location: " . BG_URL_USER . "ctl.php?mod=reg&act_get=form&alert=" . $arr_regRow["alert"]);
            exit;
        }
        break;
    case "mailbox":