60 lines
1.7 KiB
PHP
Executable File
60 lines
1.7 KiB
PHP
Executable File
<?php
|
|
include_once 'path.php';
|
|
$stDestinationURL = UPGRADE_ACCOUNT_CGI_PATH;
|
|
|
|
if($_SESSION['validUser'] === true && $_SESSION['userName']!=''){
|
|
$userName = urlencode($_SESSION['userName']);
|
|
$password = urlencode(base64_decode($_SESSION['password']));
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL,UPGRADE_LOGIN_PATH);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS,"uid=$userName&pwd=$password&op_type=upgrade");
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
/* For Proxy - Start*/
|
|
$accountSettingsFilePath = Scheduler::$user_dir."ACCOUNT_SETTINGS_FILE";
|
|
if(file_exists($accountSettingsFilePath)){
|
|
$lines = readAccountSettingsFile();
|
|
|
|
$proxyString=$lines['PROXY'];
|
|
|
|
/* For Proxy - End*/
|
|
if($proxyString!=''){
|
|
|
|
/* strtok($proxyString, "=");
|
|
$proxyString = strtok("=");*/
|
|
$proxyString = trim($proxyString);
|
|
$proxy_Array = preg_split( "/[:@]/", $proxyString);
|
|
|
|
//IP & Port
|
|
if(!empty($proxy_Array[2])){
|
|
$proxy = "$proxy_Array[2]:$proxy_Array[3]";
|
|
curl_setopt($ch, CURLOPT_PROXY, $proxy);
|
|
}
|
|
//Username & Password
|
|
if(!empty($proxy_Array[0])){
|
|
$proxyauth = "$proxy_Array[0]:$proxy_Array[1]";
|
|
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
// receive server response ...
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
$server_output = curl_exec($ch);
|
|
curl_close ($ch);
|
|
|
|
// further processing ....
|
|
if($server_output != '' && strpos($server_output, "SUCCESS") !== FALSE) {
|
|
$authToken = str_replace('SUCCESS:', '', $server_output);
|
|
$stDestinationURL = UPGRADE_AUTOLOGIN_CGI_PATH . "?token=" . $authToken;
|
|
header("Location:$stDestinationURL");
|
|
} else {
|
|
header("Location:$stDestinationURL");
|
|
}
|
|
} else {
|
|
header("Location:$stDestinationURL");
|
|
}
|
|
?>
|