2010-05-19 42 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已經登錄了點。