我们目前正在使用汽车业,我们有下面的方法来自动登录用户使用那里的电子邮件,问题是当电子邮件有一个加号,它不会自动登录。
/**
* @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×tamp=$timestamp&hash=$hash&goto=" . urlencode($goto);
header("Location: $url");
exit;
}以前有人试过吗?有一个正常的电子邮件地址工作完美,但在包含加号的电子邮件,它不会自动记录用户。
发布于 2016-12-08 14:22:25
我不知道为什么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)."×tamp=$timestamp&hash=$hash&goto=" . urlencode($goto);
header("Location: $url");
exit;
}https://stackoverflow.com/questions/40804725
复制相似问题