2010-05-19 40 views
0

有谁知道是否有办法自动登录到CPanel 11然后重定向到其他地方?我已经尝试了一切,有些事情比其他事情更好,例如,使用和iFrame我可以实现这一点,但只能在Firefox中使用。 XMLHttpRequest和Curl都不起作用。唯一的解决方案是重新创建表单并在页面加载后自动提交,但这对我不起作用,因为我不想在登录后进入CPanel,我想要进入我自己的菜单,有一个指向CPanel的链接。 由于提前,CPanel 11自动登录?

d

+0

重定向到其他地方?你的意思是登录到cPanel,例如重定向到仍然在cPanel中的电子邮件帐户列表? – 2010-07-10 19:48:28

回答

4

试试这个,不知道它的工作原理:让这个功能需要

POST: http://cpanelurl/login/ 

parameters: 
login_theme=cpanel&user=yourusername&pass=yourpassword&goto_uri=yoururl 

example: 
POST to: http://cpanel.spacenets.com/login/ 
parameters: login_theme=cpanel&user=bluebl&pass=23dff&goto_uri=http%3A%2F%2Fwww.youtube.com 
0

元素是 -

Server/WHM Username 
    Cpanel account Username 
    Server login URL 
    Server accesshash key 

而对于Accesshash关键,新的或已经生成的访问密钥可以从这里获得: - WHM>远程访问密钥区和位于那里的访问密钥。 或者它应该是在这条道路“的/ usr /本地/的cPanel /斌/ realmkaccesshash

$query = "https://$server_login_link:2087/json-api/create_user_session? 
api.version=1&user=$cpanel_user&service=cpaneld"; 
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); 
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); 

$header[0] = "Authorization: WHM $whmusername:" . 
preg_replace("'(\r|\n)'","",$hash); 
curl_setopt($curl,CURLOPT_HTTPHEADER,$header); 
curl_setopt($curl, CURLOPT_URL, $query); 
$result = curl_exec($curl); 

if ($result == false) { 
    // your error log 
} 
if($result){ 
    $decoded_response = json_decode($result, true); 
    if(isset($decoded_response['data']) && !empty($decoded_response['data'])) 
    { 
     $url = $decoded_response['data']['url']; 
     return $url;   
    } 

} 

当你打开一个新标签返回的网址,然后的cPanel已经登录了点。