Whmcs 自动认证

Whmcs auto auth

我们目前正在使用auto auth and we have the method below to log in the user automatically using there email, the problem is when the email has a plus sign它不会自动登录。

/**
 * @param $email Clients Email Address to Login
 * @param string $goto is a url endpoint where you want to redirect the user
 */
public static function autoLoginUser( $email, $goto = 'index.php?m=dashboard' )
{
    global $CONFIG;

    /**
     * Define WHMCS url and AuthKey from confguration.php
     */
    $whmcsurl = $CONFIG['SystemURL'] . "/dologin.php";
    $autoauthkey = "Our auth key is here"; //$autoauthkey from configuration.php

    $timestamp = time(); //Get current timestamp
    $hash = sha1($email . $timestamp . $autoauthkey); //Generate Hash

    /**
     * Generate AutoAuth URL & Redirect
     */
    $url = $whmcsurl . "?email=$email&timestamp=$timestamp&hash=$hash&goto=" . urlencode($goto);
    header("Location: $url");
    exit;
}

有人试过这个吗?拥有一个普通的电子邮件地址可以完美地工作,但在包含加号的电子邮件上它不会自动记录用户。

我不知道为什么它没有记录在 whmcs 中,但我们设法解决的问题是像下面的代码一样对电子邮件进行编码

/**
 * @param $email Clients Email Address to Login
 * @param string $goto is a url endpoint where you want to redirect the user
 */
public static function autoLoginUser( $email, $goto = 'index.php?m=dashboard' )
{
    global $CONFIG;

    /**
     * Define WHMCS url and AuthKey from confguration.php
     */
    $whmcsurl = $CONFIG['SystemURL'] . "/dologin.php";
    $autoauthkey = "Our auth key is here"; //$autoauthkey from configuration.php

    $timestamp = time(); //Get current timestamp
    $hash = sha1($email . $timestamp . $autoauthkey); //Generate Hash
    $email = 
    /**
     * Generate AutoAuth URL & Redirect
     */
    $url = $whmcsurl . "?email=".urlencode($email)."&timestamp=$timestamp&hash=$hash&goto=" . urlencode($goto);
    header("Location: $url");
    exit;
}