";
if ('.' == extension_dir()) {
$dirphrase = is_ms_windows()?'folder':'directory';
echo "Please note that on your system the Loader must be present in the same " . $dirphrase . " as the first encoded file accessed.";
}
echo '';
loader_download_instructions();
$loader_dir = loader_install_instructions(SERVER_SHARED,dirname(__FILE__));
shared_test_instructions();
echo '';
echo '
';
}
function runtime_loading_errors()
{
$errors = array();
$ext_path = extension_dir_path();
if (false === $ext_path) {
$errors[ERROR_RUNTIME_EXT_DIR_NOT_FOUND] = "Extensions directory cannot be found.";
} else {
$expected_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . get_loader_name();
if (!@file_exists($expected_file)) {
$errors[ERROR_RUNTIME_LOADER_FILE_NOT_FOUND] = "The Loader file was expected to be at $expected_file but could not be found.";
} else {
$errors = loader_compatibility_test($expected_file);
}
}
return $errors;
}
function windows_package_name()
{
$sys = get_sysinfo();
$loader = get_loaderinfo();
return (LOADERS_PACKAGE_PREFIX . 'win' . '_' . ($sys['THREAD_SAFE']?'':'nonts_') . strtolower($sys['PHP_COMPILER']) . '_' . $loader['arch']);
}
function unix_package_name()
{
$sysinfo = get_sysinfo();
$loader = get_loaderinfo();
$multiple_os_versions = false;
if (is_array($loader) && array_key_exists('osvariants',$loader) && is_array($loader['osvariants'])) {
$versions = array_values($loader['osvariants']);
$multiple_os_versions = !empty($versions[0]);
}
if ($multiple_os_versions) {
list($reqd_version,$exact_match) = get_reqd_version($loader['osvariants']);
if ($reqd_version) {
$basename = LOADERS_PACKAGE_PREFIX . $loader['oscode'] . '_' . $reqd_version . '_' . $loader['arch'];
} else {
$basename = "";
}
} else {
$basename = LOADERS_PACKAGE_PREFIX . $loader['oscode'] . '_' . $loader['arch'];
}
return array($basename,$multiple_os_versions);
}
function loader_download_instructions()
{
$sysinfo = get_sysinfo();
$loader = get_loaderinfo();
$multiple_os_versions = false;
if (is_ms_windows()) {
if (is_bool($sysinfo['THREAD_SAFE'])) {
$download_str = '
Download the following archive of Windows ' . $sysinfo['PHP_COMPILER'];
if (!$sysinfo['THREAD_SAFE']) {
$download_str .= ' non-TS';
}
$download_str .= ' ' . $loader['arch'] . ' Loaders:';
echo $download_str;
$basename = windows_package_name();
echo make_archive_list($basename,array('zip'));
echo 'A Loaders archive can also be downloaded from ' . LOADERS_PAGE . '.';
} else {
echo '
Download a Windows Loaders archive from here. If PHP is built with thread safety disabled, use the Windows non-TS Loaders.';
}
} else {
list($basename,$multiple_os_versions) = unix_package_name();
if ($basename == "") {
echo '
Download a ' . $loader['osname'] . ' ' . $loader['arch'] . ' Loaders archive from here.';
echo " Your system appears to be ${loader['osnamequal']} for ${loader['wordsize']} bit. If Loaders are not available for that exact release of ${loader['osname']}, Loaders built for an earlier release should work. Note that you may need to install back compatibility libraries for the operating system.";
echo ' If you cannot find a suitable loader then please raise a ticket at our support helpdesk.';
} else {
echo '
Download one of the following archives of Loaders for ' . $loader['osnamequal'] . ' ' . $loader['arch'] . ':';
if (SERVER_SHARED == find_server_type()) {
$archives = array('zip','tar.gz','tar.bz2');
} else {
$archives = array('tar.gz','tar.bz2');
}
echo make_archive_list($basename,$archives);
echo "";
if ($multiple_os_versions && !$exact_match) {
echo "
Note that you may need to install back compatibility libraries for ${loader['osname']}.
Edit the $php_ini_name in the $ini_dir directory";
if (zend_extension_line_missing($php_ini_path) && @is_writeable($php_ini_path) && @is_writeable($ini_dir)) {
if (function_exists('file_get_contents')) {
$ini_strs = @file_get_contents($php_ini_path);
} else {
$lines = @file($php_ini_path);
$ini_strs = join(' ',$lines);
}
$fh = @fopen($php_ini_path,"wb");
if ($fh !== false) {
foreach ($zend_extension_lines as $zl) {
fwrite($fh,$zl . PHP_EOL);
}
fwrite($fh,$ini_strs);
fclose($fh);
$editing_ini = false;
echo "
Your php.ini file at $php_ini_path has been modified to include the necessary line for the ionCube Loader.";
} else {
echo $edit_line;
}
} else {
echo $edit_line;
}
} else {
$download_ini_file = "
Save this $php_ini_name file and upload it to $ini_dir (full path on your server).";
if (@is_writeable($ini_dir)) {
$fh = @fopen($php_ini_path,"wb");
if ($fh !== false) {
foreach ($zend_extension_lines as $zl) {
fwrite($fh,$zl . PHP_EOL);
}
if (!empty($sysinfo['PHP_INI']) && is_readable($sysinfo['PHP_INI'])) {
if (function_exists('file_get_contents')) {
$ini_strs = @file_get_contents($sysinfo['PHP_INI']);
} else {
$lines = @file($sysinfo['PHP_INI']);
$ini_strs = join(' ',$lines);
}
fwrite($fh,$ini_strs);
}
fclose($fh);
echo "
A $php_ini_name file has been created for you in $ini_dir.";
} else {
echo $download_ini_file;
}
} else {
echo $download_ini_file;
}
$editing_ini = false;
}
} elseif (!empty($sysinfo['PHP_INI'])) {
if (empty($sysinfo['PHP_INI_DIR'])) {
echo "
Edit the file ${sysinfo['PHP_INI']}";
} else {
$php_ini_path = find_additional_ioncube_ini();
if (empty($php_ini_path)) {
$php_ini_name = ADDITIONAL_INI_FILE_NAME;
echo "
Save this $php_ini_name file and put it in your ini files directory, ${sysinfo['PHP_INI_DIR']}";
$editing_ini = false;
} else {
$php_ini_name = basename($php_ini_path);
echo "
Edit the file $php_ini_path";
}
}
} else {
echo "
Edit the system $php_ini_name file";
}
if ($editing_ini) {
echo " and before any other $kwd lines ensure that the following is included: ";
foreach ($zend_extension_lines as $zl) {
echo "$zl ";
}
if (!empty($php_ini_path)) {
if (zend_extension_line_missing($php_ini_path)) {
echo "Alternatively, replace your current $php_ini_path file with this new $php_ini_name file.";
}
}
}
echo '
';
}
function server_restart_instructions()
{
$sysinfo = get_sysinfo();
$base = get_base_address();
if ($sysinfo['SS']) {
echo "
With your hosting account, you may be able to use your own PHP configuration file.
';
} else {
echo "
It appears that you cannot install the ionCube Loader using the $php_ini_name file. Your server provider or system administrator should be able to perform the installation for you. Please refer them to the following instructions.
';
if ($server_type_desc) {
echo "For a $server_type_desc server ";
} else {
echo "For this server ";
}
if ($required) {
echo "you should install the ionCube Loader using the $php_ini_name configuration file.";
} else {
echo "installing the ionCube Loader using the $php_ini_name file is recommended.";
}
if ($server_type_desc) {
echo " (Please click here if you are not on a $server_type_desc server.)";
}
echo '
A downloadable archive of system information could not be created. Please save each of the following and then attach those files to the support ticket:
";
footer(true);
}
}
function support_ticket_information($error_list = array())
{
$sys = get_sysinfo();
$ld = get_loaderinfo();
$ticket_strs = array();
$ticket_strs[] = "PLEASE DO NOT REMOVE THE FOLLOWING INFORMATION\r\n";
$ticket_strs[] = "==============\r\n";
if (!empty($error_list)) {
$ticket_strs[] = "[hr]";
$ticket_strs[] = "ERRORS";
$ticket_strs[] = "[table]";
$ticket_strs[] = '[tr][td]' . join('[/td][/tr][tr][td]',$error_list) . '[/td][/tr]';
$ticket_strs[] = "[/table]";
}
$ticket_strs[] = "[hr]";
$ticket_strs[] = "SYSTEM INFORMATION";
$info_lines = array();
$info_lines["Wizard version"] = script_version();
$info_lines["PHP uname"] = $ld['uname'];
$info_lines["Machine architecture"] = $ld['arch'];
$info_lines["Word size"] = $ld['wordsize'];
$info_lines["Operating system"] = $ld['osname'] . ' ' . $ld['osver'];
if (selinux_is_enabled() || possibly_selinux()) {
$info_lines["Security enhancements"] = "SELinux";
} elseif (grsecurity_is_enabled()) {
$info_lines["Security enhancements"] = "Grsecurity";
} else {
$info_lines["Security enhancements"] = "None";
}
$info_lines["PHP version"] = PHP_VERSION;
if ($sys['DEBUG_BUILD']) {
$info_lines["DEBUG BUILD"] = "DEBUG BUILD OF PHP";
}
if (!$sys['SUPPORTED_COMPILER']) {
$info_lines["SUPPORTED PHP COMPILER"] = "FALSE";
$info_lines["PHP COMPILER"] = $sys['PHP_COMPILER'];
}
$info_lines["Is CLI?"] = ($sys['IS_CLI']?"Yes":"No");
$info_lines["Is CGI?"] = ($sys['IS_CGI']?"Yes":"No");
$info_lines["Is thread-safe?"] = ($sys['THREAD_SAFE']?"Yes":"No");
$info_lines["Web server"] = $sys['FULL_SS'];
$info_lines["Server type"] = server_type_string();
$info_lines["PHP ini file"] = $sys['PHP_INI'];
if (!@file_exists($sys['PHP_INI'])) {
$info_lines["Ini file found"] = "INI FILE NOT FOUND";
} else {
if (is_readable($sys['PHP_INI'])) {
$info_lines["Ini file found"] = "INI FILE READABLE";
} else {
$fh = @fopen($sys['PHP_INI'],"rb");
if ($fh === false) {
$info_lines["Ini file found"] = "INI FILE FOUND BUT POSSIBLY NOT READABLE";
} else {
$info_lines["Ini file found"] = "INI FILE READABLE";
}
}
}
$info_lines["PHPRC"] = $sys['PHPRC'];
$loader_path = find_loader();
if (is_string($loader_path)) {
$info_lines["Loader path"] = $loader_path;
$info_lines["Loader file size"] = filesize($loader_path) . " bytes.";
$info_lines["Loader MD5 sum"] = md5_file($loader_path);
} else {
$info_lines["Loader path"] = "LOADER PATH NOT FOUND";
}
$server_type_code = server_type_code();
if (!empty($_SESSION['hostprovider'])) {
$info_lines['Hosting provider'] = $_SESSION['hostprovider'];
$info_lines['Provider URL'] = $_SESSION['hosturl'];
}
$info_lines["Wizard script path"] = '[url]http://' . $_SERVER["HTTP_HOST"] . get_self() . '?stype='. $server_type_code . '[/url]';
$ticket_strs[] = "[table]";
foreach ($info_lines as $h => $i) {
$value = (empty($i))?'EMPTY':$i;
$ticket_strs[] = '[tr][td]' . $h . '[/td]' . '[td]' . $value . '[/td][/tr]';
}
$ticket_strs[] = '[/table]';
$ticket_strs[] = '[hr]';
$ticket_strs[] = "\r\n==============\r\n";
$ticket_strs[] = "PLEASE ENTER ANY ADDITIONAL INFORMATION BELOW\r\n";
$support_ticket_str = join('',$ticket_strs);
return urlencode($support_ticket_str);
}
function wizard_stats_data($page_id)
{
$data = array();
try_runtime_loading_if_applicable();
$sysinfo = get_sysinfo();
$ldinfo = get_loaderinfo();
$data['sessionid'] = session_id();
$data['wizard_version'] = script_version();
$data['server_type'] = server_type_code();
$data['hostprovider'] = (isset($_SESSION['hostprovider']))?$_SESSION['hostprovider']:'';
$data['hosturl'] = (isset($_SESSION['hosturl']))?$_SESSION['hosturl']:'';
$data['page_id'] = $page_id;
$data['loader_state'] = (extension_loaded(LOADER_EXTENSION_NAME))?'installed':'failure';
$data['ini_location'] = $sysinfo['PHP_INI'];
$data['is_cgi'] = ($sysinfo['IS_CGI'])?"yes":"no";
$data['is_ts'] = ($sysinfo['THREAD_SAFE'])?"yes":"no";
$data['arch'] = $ldinfo['arch'];
$data['php_version'] = PHP_VERSION;
$data['os'] = $ldinfo['osname'];
$data['word_size'] = $ldinfo['wordsize'];
$data['referrer'] = $_SERVER["HTTP_HOST"] . get_self();
return $data;
}
function send_stats($page_id = 'default')
{
$server_type = find_server_type();
$res = false;
if (SERVER_LOCAL != $server_type) {
$stats_data = wizard_stats_data($page_id);
if (!isset($_SESSION['stats_sent'][$page_id][$stats_data['loader_state']])) {
$url = WIZARD_STATS_URL;
if (!empty($stats_data)) {
if(function_exists('http_build_query')) {
$qparams = http_build_query($stats_data);
} else {
$qparams = php4_http_build_query($stats_data);
}
$url .= '?' . $qparams;
$res = remote_file_contents($url);
}
$_SESSION['stats_sent'][$page_id][$stats_data['loader_state']] = 1;
} else {
$res = true;
}
} else {
$res = 'LOCAL';
}
return $res;
}
function os_arch_string_check($loader_str)
{
$errors = array();
if (preg_match("/target os:\s*(([^_]+)_([^-]*)-([[:graph:]]*))/i",$loader_str,$os_matches)) {
$loader_info = get_loaderinfo();
$dirname = calc_dirname();
$packed_osname = preg_replace('/\s/','',strtolower($loader_info['osname']));
if (strtolower($dirname) != $os_matches[1] && $packed_osname != $os_matches[2]) {
$errors[ERROR_LOADER_WRONG_OS] = "You have the wrong loader for your operating system, ". $loader_info['osname'] . ".";
} else {
$loader_wordsize = (strpos($os_matches[3],'64') === false)?32:64;
if ($loader_info['arch'] != ($ap = required_loader_arch($os_matches[3],$loader_info['oscode'],$loader_wordsize))) {
$err_str = "You have the wrong loader for your machine architecture.";
$err_str .= " Your system is " . $loader_info['arch'];
$err_str .= " but the loader you are using is for " . $ap . ".";
$errors[ERROR_LOADER_WRONG_ARCH] = $err_str;
}
}
}
return $errors;
}
function get_loader_strings($loader_location)
{
if (function_exists('file_get_contents')) {
$loader_strs = @file_get_contents($loader_location);
} else {
$lines = @file($loader_location);
$loader_strs = join(' ',$lines);
}
return $loader_strs;
}
function loader_system($loader_location)
{
$loader_system = array();
$loader_strs = get_loader_strings($loader_location);
if (!empty($loader_strs)) {
if (preg_match("/ioncube_loader_..?\.._(.)\.(.)\.(..?)(_nonts)?(_amd64)?\.dll/i",$loader_strs,$version_matches)) {
$loader_system['oscode'] = 'win';
$loader_system['thread_safe'] = (isset($version_matches[4]) && $version_matches[4] == '_nonts')?0:1;
if (preg_match("/_localtime([0-9][0-9])/i",$loader_strs,$size_matches)) {
$loader_system['wordsize'] = ($size_matches[1] == '64')?64:32;
} else {
$loader_system['wordsize'] = 32;
}
$loader_system['arch'] = ($loader_system['wordsize'] == 64)?'x86-64':'x86';
$loader_system['php_version_major'] = $version_matches[1];
$loader_system['php_version_minor'] = $version_matches[2];
if ($loader_system['php_version_major'] == 7 && $loader_system['php_version_minor'] >= 2) {
$loader_system['compiler'] = 'VC15';
} elseif ($loader_system['php_version_major'] == 7 && $loader_system['php_version_minor'] < 2) {
$loader_system['compiler'] = 'VC14';
} elseif ($loader_system['php_version_major'] == 5 && $loader_system['php_version_minor'] >= 5) {
$loader_system['compiler'] = 'VC11';
} elseif (preg_match("/assemblyIdentity.*version=\"([^.]+)\./",$loader_strs,$compiler_matches)) {
$loader_system['compiler'] = "VC" . strtoupper($compiler_matches[1]);
} else {
$loader_system['compiler'] = 'VC6';
}
} elseif (preg_match("/php version:\s*(.)\.(.)\.(..?)(-ts)?/i",$loader_strs,$version_matches)) {
$loader_system['thread_safe'] = (isset($version_matches[4]) && $version_matches[4] == '-ts')?1:0;
$loader_system['php_version_major'] = $version_matches[1];
$loader_system['php_version_minor'] = $version_matches[2];
if (preg_match("/target os:\s*(([^_]+)_([^-]*)-([[:graph:]]*))/i",$loader_strs,$os_matches)) {
$loader_system['oscode'] = strtolower(substr($os_matches[2],0,3));
$loader_system['wordsize'] = (strpos($os_matches[3],'64') === false)?32:64;
$loader_system['arch'] = required_loader_arch($os_matches[3],$loader_system['oscode'],$loader_system['wordsize']);
$loader_system['compiler'] = $os_matches[4];
}
}
if (preg_match("/ionCube Loader Version\s+(\S+)/",$loader_strs,$loader_version)) {
$loader_system['loader_version'] = $loader_version[1];
} elseif (preg_match("/ioncube_loader_(\d{1,2}\.\d\.\d{1,2})\./",$loader_strs,$loader_version)){
$loader_system['loader_version'] = $loader_version[1];
} else {
$loader_system['loader_version'] = 'UNKNOWN';
}
if (isset($loader_system['php_version_major'])) {
$loader_system['php_version'] = $loader_system['php_version_major'] . '.' . $loader_system['php_version_minor'];
}
}
return $loader_system;
}
function loader_compatibility_test($loader_location)
{
$errors = array();
$sysinfo = get_sysinfo();
if (LOADER_NAME_CHECK) {
$installed_loader_name = basename($loader_location);
$expected_loader_name = get_loader_name();
if ($installed_loader_name != $expected_loader_name) {
$errors[ERROR_LOADER_UNEXPECTED_NAME] = "The installed loader ($installed_loader_name) does not have the name expected ($expected_loader_name) for your system. Please check that you have the correct loader for your system.";
}
}
if (empty($errors) && !is_readable($loader_location)) {
$execute_error = "The loader at $loader_location does not appear to be readable.";
$execute_error .= " Please check that it exists and is readable.";
$execute_error .= " Please also check the permissions of the containing ";
$execute_error .= (is_ms_windows()?'folder':'directory') . '.';
if (($sysinfo['SS'] == 'IIS') || !($sysinfo['IS_CGI'] || $sysinfo['IS_CLI'])) {
$execute_error .= " Please also check that the web server has been restarted.";
}
$execute_error .= ".";
$errors[ERROR_LOADER_NOT_READABLE] = $execute_error;
}
$loader_strs = get_loader_strings($loader_location);
$phpv = php_version();
if (preg_match("/php version:\s*(.)\.(.)\.(..?)(-ts)?/i",$loader_strs,$version_matches)) {
if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
$loader_php = $version_matches[1] . "." . $version_matches[2];
$server_php = $phpv['major'] . "." . $phpv['minor'];
$errors[ERROR_LOADER_PHP_MISMATCH] = "The installed loader is for PHP $loader_php but your server is running PHP $server_php.";
}
if (is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'] && !is_ms_windows() && !(isset($version_matches[4]) && $version_matches[4] == '-ts')) {
$errors[ERROR_LOADER_NONTS_PHP_TS] = "Your server is running a thread-safe version of PHP but the loader is not a thread-safe version.";
} elseif (isset($version_matches[4]) && $version_matches[4] == '-ts' && !(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'])) {
$errors[ERROR_LOADER_TS_PHP_NONTS] = "Your server is running a non-thread-safe version of PHP but the loader is a thread-safe version.";
}
} elseif (preg_match("/ioncube_loader_..?\.._(.)\.(.)\.(..?)(_nonts)?(_amd64)?\.dll/i",$loader_strs,$version_matches)) {
if (!is_ms_windows()) {
$errors[ERROR_LOADER_WIN_SERVER_NONWIN] = "You have a Windows loader but your server does not appear to be running Windows.";
} else {
if (isset($version_matches[4]) && $version_matches[4] == '_nonts' && is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) {
$errors[ERROR_LOADER_WIN_NONTS_PHP_TS] = "You have the non-thread-safe version of the Windows loader but you need the thread-safe one.";
} elseif (!(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) && !(isset($version_matches[4]) && $version_matches[4] == '_nonts')) {
$errors[ERROR_LOADER_WIN_TS_PHP_NONTS] = "You have the thread-safe version of the Windows loader but you need the non-thread-safe one.";
}
if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
$loader_php = $version_matches[1] . "." . $version_matches[2];
$server_php = $phpv['major'] . "." . $phpv['minor'];
$errors[ERROR_LOADER_WIN_PHP_MISMATCH] = "The installed loader is for PHP $loader_php but your server is running PHP $server_php.";
}
if ($version_matches[1]== 7 && $version_matches[2] >= 2) {
$loader_compiler = 'VC15';
} else if ($version_matches[1]== 7) {
$loader_compiler = 'VC14';
} elseif ($version_matches[1]== 5 && $version_matches[2] >= 5) {
$loader_compiler = 'VC11';
} elseif (preg_match("/assemblyIdentity.*version=\"([^.]+)\./",$loader_strs,$compiler_matches)) {
$loader_compiler = "VC" . strtoupper($compiler_matches[1]);
} else {
$loader_compiler = 'VC6';
}
if ($loader_compiler != $sysinfo['PHP_COMPILER']) {
$errors[ERROR_LOADER_WIN_COMPILER_MISMATCH] = "Your loader was built using $loader_compiler but you need the loader built using ${sysinfo['PHP_COMPILER']}.";
}
}
} else {
$errors[ERROR_LOADER_PHP_VERSION_UNKNOWN] = "The PHP version for the loader cannot be determined - please check that you have a valid ionCube Loader.";
}
$errors += os_arch_string_check($loader_strs);
return $errors;
}
function shared_server()
{
if (!$rtl_path = runtime_loading()) {
if (empty($_SESSION['use_ini_method']) && runtime_loading_is_possible()) {
runtime_loading_instructions();
} else {
php_ini_install_shared();
}
} else {
list($lv,$mv,$newer_version) = ioncube_loader_version_information();
$phpv = php_version_maj_min();
echo "
The ionCube Loader $lv for PHP $phpv has been successfully installed.
";
$is_legacy_loader = loader_major_version_instructions($mv);
if ($is_legacy_loader) {
loader_upgrade_instructions($lv,$newer_version);
}
successful_install_end_instructions($rtl_path);
}
}
function dedicated_server()
{
php_ini_install('dedicated or VPS', SERVER_DEDICATED, true);
}
function local_install()
{
php_ini_install('local',SERVER_LOCAL, true);
}
function unregister_globals()
{
if (!ini_get('register_globals')) {
return;
}
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die('GLOBALS overwrite attempt detected');
}
$noUnset = array('GLOBALS', '_GET',
'_POST', '_COOKIE',
'_REQUEST', '_SERVER',
'_ENV', '_FILES');
$input = array_merge($_GET, $_POST,
$_COOKIE, $_SERVER,
$_ENV, $_FILES,
isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
foreach ($input as $k => $v) {
if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) {
unset($GLOBALS[$k]);
}
}
}
function clear_session($persist = array())
{
$persist['not_go_daddy'] = empty($_SESSION['not_go_daddy'])?0:1;
$persist['use_ini_method'] = empty($_SESSION['use_ini_method'])?0:1;
$persist['server_type'] = empty($_SESSION['server_type'])?SERVER_UNKNOWN:$_SESSION['server_type'];
@session_destroy();
$_SESSION = array();
$_SESSION['CREATED'] = time();
$_SESSION = $persist;
}
function can_archive()
{
return (extension_loaded('zip') || (extension_loaded('zlib') && !is_ms_windows()));
}
function is_ioncube()
{
return (($_SERVER["REMOTE_ADDR"] == IONCUBE_IP_ADDRESS) || ($_SERVER["REMOTE_ADDR"] == gethostbyname(IONCUBE_ACCESS_ADDRESS)));
}
function can_reach_ioncube()
{
return (isset($_SESSION['remote_access_successful']));
}
function info_should_be_disabled($only_allow_ioncube = false)
{
$elapsed = time() - max(filemtime(__FILE__),filectime(__FILE__));
if (is_ioncube()) {
$cutoff_time = IONCUBE_WIZARD_EXPIRY_MINUTES * 60;
} else {
if (!$only_allow_ioncube && !extension_loaded(LOADER_EXTENSION_NAME)) {
$cutoff_time = WIZARD_EXPIRY_MINUTES * 60;
} else {
return true;
}
}
return ($elapsed > $cutoff_time);
}
function info_disabled_text()
{
return "The information you have tried to access has been disabled for security reasons. Please re-install this Loader Wizard script and try again.";
}
function info_disabled_check()
{
if (info_should_be_disabled()) {
heading();
echo info_disabled_text();
footer(true);
exit;
}
}
function run()
{
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/googlebot/i',$user_agent)) {
exit;
}
unregister_globals();
if (is_php_version_or_greater(4,3,0)) {
ini_set('session.use_only_cookies',1);
}
$session_ok = @session_start();
if (!defined('PHP_EOL')) {
if (is_ms_windows()) {
define('PHP_EOL',"\r\n");
} else {
define('PHP_EOL',"\n");
}
}
if (!isset($_SESSION['CREATED'])) {
$_SESSION['CREATED'] = time();
} elseif (time() - $_SESSION['CREATED'] > SESSION_LIFETIME_MINUTES * 60 ) {
clear_session();
}
if (!isset($_SERVER)) $_SERVER =& $HTTP_SERVER_VARS;
(php_sapi_name() == 'cli') && die("This script should only be run by a web server.\n");
$page = get_request_parameter('page');
$host = get_request_parameter('host');
$clear = get_request_parameter('clear');
$ini = get_request_parameter('ini');
$timeout = get_request_parameter('timeout');
if ($timeout) {
$_SESSION['timing_out'] = 1;
$_SESSION['initial_run'] = 0;
}
if (!empty($host)) {
if ($host == 'ngd') {
$_SESSION['not_go_daddy'] = 1;
}
}
if (!empty($ini)) {
$_SESSION['use_ini_method'] = 1;
}
if (!empty($clear)) {
clear_session();
unset($_SESSION['not_go_daddy']);
unset($_SESSION['use_ini_method']);
unset($_SESSION['server_type']);
} else {
$stype = get_request_parameter('stype');
$hostprovider = get_request_parameter('hostprovider');
$hosturl = get_request_parameter('hosturl');
if (!empty($hostprovider)) {
$_SESSION['hostprovider'] = $hostprovider;
$_SESSION['hosturl'] = $hosturl;
}
$server_type = find_server_type($stype,false,true);
}
if ($session_ok && !$timeout && !isset($_SESSION['initial_run']) && empty($page)) {
$_SESSION['initial_run'] = 1;
initial_page();
@session_write_close();
exit;
} else {
$_SESSION['initial_run'] = 0;
}
if (empty($_SESSION['server_type'])) {
$_SESSION['server_type'] = SERVER_UNKNOWN;
}
if (empty($page) || !function_exists($page . "_page")) {
$page = get_default_page();
}
$fn = "${page}_page";
$fn();
@session_write_close();
exit(0);
}
function wizardversion_page()
{
$start_time = time();
$wizard_version_only = get_request_parameter('wizard_only');
$clear_session_info = get_request_parameter('clear_info');
if ($clear_session_info) {
unset($_SESSION['timing_out']);
unset($_SESSION['latest_wizard_version']);
}
$wizard_version = latest_wizard_version();
$message = '';
if (false === $wizard_version) {
$message = "0";
} elseif (update_is_available($wizard_version)) {
$message = "$wizard_version";
} else {
$message = "1";
}
echo $message;
@session_write_close();
exit(0);
}
function platforminfo_page()
{
$message = '';
$platforms = get_loader_platforms();
$message = empty($platforms)?0:1;
echo $message;
@session_write_close();
exit(0);
}
function loaderversion_page()
{
$message = '';
$loader_versions = get_loader_version_info();
$message = empty($loader_versions)?0:1;
echo $message;
@session_write_close();
exit(0);
}
function compilerversion_page()
{
$message = '';
$compiler_versions = find_win_compilers();
$message = empty($compiler_versions)?0:1;
echo $message;
@session_write_close();
exit(0);
}
function initial_page()
{
$self = get_self();
$start_page = get_default_address(false);
$stage_timeout = 7000;
$step_lag = 500;
echo <<ionCube Loader Wizard
Your browser does not support JavaScript so the ionCube Loader Wizard initialisation cannot be made now. This script can get the latest loader version information from the ionCube server when you go to the next page. Please choose one of the following. If the script appears to hang please restart the script and choose the "NO" option.
Please note that if encoded files in a different $dirphrase from the Wizard fail then you should attempt to copy the $ini file to each $dirphrase in which you have encoded files.
";
}
}
function cli_install_instructions()
{
if (is_php_version_or_greater(5,3)) {
$cli_loader_installed = shell_exec('php -r "echo extension_loaded(\"' . LOADER_EXTENSION_NAME . '\");"');
if (!$cli_loader_installed) {
$cli_php_ini_output = shell_exec("php --ini");
$ini_loader_loc = scan_inis_for_loader();
if (!is_null($cli_php_ini_output)) {
echo '
';
echo '
Loader Installation for Command-Line (CLI) PHP
';
echo "
At present it does not look like the ionCube Loader is installed for command-line (CLI) PHP.
";
echo "
Please note that if you need to run the CLI PHP, such as for cron jobs, then please ensure the zend_extension line for the ionCube Loader is included in your CLI PHP configuration.
";
if (!empty($ini_loader_loc['location'])) {
echo "
The zend_extension line that needs to be copied is:
';
}
}
}
}
function successful_install_end_instructions($rtl_path = null)
{
if (empty($rtl_path)) {
may_need_to_copy_ini();
} elseif (is_string($rtl_path)) {
echo "
The runtime loading method of installation was used with path $rtl_path
";
}
contact_script_provider_instructions();
if (is_legacy_platform()) {
legacy_platform_instructions();
}
if (!is_ms_windows() && is_php_version_or_greater(5,3)) {
cli_install_instructions();
}
uninstall_wizard_instructions();
ioncube_24_information();
}
function loader_major_version_instructions($mv)
{
if ($mv < LATEST_LOADER_MAJOR_VERSION) {
echo "
The installed version of the Loader cannot run files produced by the most recent ionCube Encoder.";
echo " You will need a version " . LATEST_LOADER_MAJOR_VERSION . " ionCube Loader to run such files.
The ionCube Loader version ' . $lv . $php_str . ' is already installed but it is an old version.';
echo ' It is recommended that the Loader be upgraded to the latest version if possible.
Please note that you $verb_case need your system administrator to do the following to upgrade. The web server will need to be restarted after the loader file is changed.
To upgrade from version $installed_version to $version_str of the ionCube Loader, please replace your existing loader file, $loader_name, with
the file of the same name from one of the following packages:
Once you have replaced the loader file please restart your web server.
";
}
echo '
';
}
}
function legacy_platform_warning()
{
$leg_warn = '
You are on a platform on which ionCube Loaders are no longer being developed. ';
$leg_warn .= 'Loaders on your platform may not be able to run files produced by the latest ionCube Encoder. ';
$leg_warn .= 'Please switch, if possible, to a platform on which loaders are currently supported. ';
$leg_warn .= 'A list of currently supported platforms is shown on our loaders page.
';
return $leg_warn;
}
function legacy_platform_instructions()
{
echo legacy_platform_warning();
}
function loader_not_installed()
{
$loader = get_loaderinfo();
$sysinfo = get_sysinfo();
$stype = get_request_parameter('stype');
$manual_select = get_request_parameter('manual');
$host_type = find_server_type($stype,$manual_select,true);
if ($host_type != SERVER_UNKNOWN && is_array($loader) && !$sysinfo['DEBUG_BUILD']) {
$warnings = server_restriction_warnings();
if (is_legacy_platform()) {
$warnings[] = legacy_platform_warning();
}
if (empty($_SESSION['use_ini_method']) && $host_type == SERVER_SHARED && runtime_loading_is_possible()) {
$errors = runtime_loading_errors();
} else {
$errors = ini_loader_errors();
$warnings = array_merge($warnings,ini_loader_warnings());
}
if (!empty($errors)) {
if (count($errors) > 1) {
$problem_str = "Please note that the following problems currently exist";
} else {
$problem_str = "Please note that the following problem currently exists";
}
echo '
' .$problem_str . ' with the ionCube Loader installation:';
echo make_list($errors,"ul");
echo '
';
echo "Please note $addword the following issue$plural:";
echo make_list($warnings,"ul");
echo '
';
}
}
if (!isset($stype)) {
echo '
To use files that have been protected by the ionCube PHP Encoder, a component called the ionCube Loader must be installed.
';
}
if (!is_supported_php_version()) {
echo '
Your server is running PHP version ' . PHP_VERSION . ' and is
unsupported by ionCube Loaders. Recommended PHP 4 versions are PHP 4.2 or higher,
and PHP 5.1 or higher for PHP 5.
';
} elseif ($latest_supported_php_version = is_after_max_php_version_supported()) {
echo 'Your server is running PHP version ' . PHP_VERSION . ' and is
currently unsupported by any ionCube Loaders. This may change in the future if a Loader is produced for your PHP platform. In the meantime please downgrade PHP to version ' . $latest_supported_php_version . '.';
} elseif ($sysinfo['DEBUG_BUILD']) {
echo '
Your server is currently running a debug build of PHP. The Loader cannot be installed with a debug build of PHP. Please ensure that PHP is reconfigured with debug disabled. Note that debug builds of PHP cannot help in debugging PHP scripts.
Loaders for 64-bit PHP on Windows are not currently available. However, if you install and run 32-bit PHP the corresponding 32-bit loader for Windows should work.
';
if ($sysinfo['THREAD_SAFE']) {
echo '
Download one of the following archives of 32-bit Windows x86 loaders:';
} else {
echo '
Download one of the following archives of 32-bit Windows non-TS x86 loaders:';
}
echo make_archive_list(windows_package_name());
} else {
echo '
There may not be an ionCube Loader available for your type of system at the moment. However, if you create a support ticket more advice and information may be available to assist. Please include the URL for this Wizard in your ticket.
At the current time the ionCube Loader requires PHP to be built with ' . $supported_compiler_string . '. Your PHP software has been built using ' . $sysinfo['PHP_COMPILER'] . '. Supported builds of PHP are available from PHP.net.';
} else {
switch ($host_type) {
case SERVER_SHARED:
shared_server();
break;
case SERVER_DEDICATED:
dedicated_server();
break;
case SERVER_LOCAL:
local_install();
break;
default:
echo server_selection_form();
break;
}
}
}
function server_selection_form()
{
$self = get_self();
$timeout = (isset($_SESSION['timing_out']) && $_SESSION['timing_out'])?1:0;
$hostprovider = (!empty($_SESSION['hostprovider']))?$_SESSION['hostprovider']:'';
$hostprovider = htmlspecialchars($hostprovider, ENT_QUOTES, 'UTF-8');
$hosturl = (!empty($_SESSION['hosturl']))?$_SESSION['hosturl']:'';
$hosturl = htmlspecialchars($hosturl, ENT_QUOTES, 'UTF-8');
$form = <<This Wizard will give you information on how to install the ionCube Loader.
Please select the type of web server that you have and then click Next.
EOT;
return $form;
}
function phpinfo_page()
{
info_disabled_check();
if (function_is_disabled('phpinfo')) {
echo "phpinfo is disabled on this server";
} else {
@phpinfo();
}
}
function loader_check_page($ext_name = LOADER_EXTENSION_NAME)
{
heading();
$rtl_path = try_runtime_loading_if_applicable();
if (extension_loaded($ext_name)) {
list($lv,$mv,$newer_version) = ioncube_loader_version_information();
$phpv = php_version_maj_min();
$php_str = ' for PHP ' . $phpv;
echo '
';
echo '
Loader Installed Successfully
';
echo '
The ionCube Loader version ' . $lv . $php_str . ' is installed and encoded files should run successfully.';
if ($newer_version) {
echo ' Please note though that you have an old version of the ionCube Loader.
The ionCube Loader is not currently installed successfully.
';
if (!is_null($rtl_path)) {
echo '
Runtime loading was attempted but has failed.
';
echo '
';
$rt_errors = runtime_loading_errors();
if (!empty($rt_errors)) {
list_loader_errors($rt_errors);
}
link_to_php_ini_instructions();
} else {
echo '';
list_loader_errors();
}
}
send_stats('check');
footer(true);
}
function ini_loader_errors()
{
$errors = array();
if (SERVER_SHARED == find_server_type() && !own_php_ini_possible(true)) {
$errors[ERROR_INI_USER_CANNOT_CREATE] = "It appears that you are not be able to create your own ini files on your shared server. You will need to ask your server administrator to install the ionCube Loader for you.";
}
$loader_loc = find_loader(false);
if (is_string($loader_loc)) {
if (!shared_and_runtime_loading()) {
$sys = get_sysinfo();
if (empty($sys['PHP_INI'])) {
$errors[ERROR_INI_NO_PATH] = 'No file path found for the PHP configuration file (php.ini).';
} elseif (!@file_exists($sys['PHP_INI'])) {
$errors[ERROR_INI_NOT_FOUND] = 'The PHP configuration file (' . $sys['PHP_INI'] .') cannot be found.';
}
}
$errors = $errors + loader_compatibility_test($loader_loc);
} else {
$errors = $errors + $loader_loc;
$fs_location = find_loader_filesystem();
if (!empty($fs_location)) {
$fs_loader_errors = loader_compatibility_test($fs_location);
if (!empty($fs_loader_errors)) {
$errors[ERROR_LOADER_WRONG_GENERAL] = "The loader file found at $fs_location is not the correct one for your system.";
}
$errors = $errors + $fs_loader_errors;
}
}
return $errors;
}
function unix_path_dir($dir = '')
{
if (empty($dir)) {
$dir = dirname(__FILE__);
}
if (is_ms_windows()) {
$dir = str_replace('\\','/',substr($dir,2));
}
return $dir;
}
function unrecognised_inis_webspace($startdir)
{
$ini_list = array();
$ini_name = ini_file_name();
$sys = get_sysinfo();
$depth = substr_count($startdir,'/');
$rel_path = '';
$rootpath = realpath($_SERVER['DOCUMENT_ROOT']);
for ($seps = 0; $seps < $depth; $seps++) {
$full_ini_loc = @realpath($startdir . '/' . $rel_path) . DIRECTORY_SEPARATOR . $ini_name;
if (@file_exists($full_ini_loc) && $sys['PHP_INI'] != $full_ini_loc) {
$ini_list[] = @realpath($full_ini_loc);
}
if (dirname($full_ini_loc) == $rootpath) {
break;
}
$rel_path .= '../';
}
return $ini_list;
}
function correct_loader_wrong_location()
{
$loader_location_pair = array();
$loader_location = find_loader_filesystem();
if (is_string($loader_location)) {
$loader_errors = loader_compatibility_test($loader_location);
if (empty($loader_errors)) {
$ini_loader = scan_inis_for_loader();
if (!empty($ini_loader['location'])) {
$ini_loader_errors = loader_compatibility_test($ini_loader['location']);
if (!empty($ini_loader_errors)) {
$loader_location_pair['loader'] = $loader_location;
$loader_location_pair['newloc'] = dirname($ini_loader['location']);
}
} else {
$std_dir = loader_install_dir(find_server_type());
$std_ld_path = $std_dir . DIRECTORY_SEPARATOR . get_loader_name();
if (@file_exists($std_ld_path)) {
$stdloc_loader_errors = loader_compatibility_test($std_ld_path);
} else {
$stdloc_loader_errors = array("Loader file does not exist.");
}
if (!empty($stdloc_loader_errors)) {
$loader_location_pair['loader'] = $loader_location;
$loader_location_pair['newloc'] = $std_dir;
}
}
}
}
return $loader_location_pair;
}
function ini_loader_warnings()
{
$warnings = array();
if (find_server_type() == SERVER_SHARED)
{
if (own_php_ini_possible()) {
$sys = get_sysinfo();
$ini_name = ini_file_name();
$rootpath = realpath($_SERVER['DOCUMENT_ROOT']);
$root_ini_file = $rootpath . DIRECTORY_SEPARATOR . $ini_name;
$cgibinpath = @realpath($_SERVER['DOCUMENT_ROOT'] . "/cgi-bin");
$cgibin_ini_file = (empty($cgibinpath))?'':$cgibinpath . DIRECTORY_SEPARATOR . $ini_name;
$here = unix_path_dir();
$ini_files = unrecognised_inis_webspace($here);
$shared_ini_loc = shared_ini_location();
$shared_ini_file = $shared_ini_loc . DIRECTORY_SEPARATOR . $ini_name;
$ini_dir = dirname($sys['PHP_INI']);
$all_ini_locations_used = !empty($ini_files);
foreach ($ini_files as $full_ini_loc) {
$advice = "The file $full_ini_loc is not being recognised by PHP.";
$advice .= " Please check that the name and location of the file are correct.";
if (!ini_same_dir_as_wizard()) {
$ini_loc_dir = dirname($full_ini_loc);
if (!@file_exists($shared_ini_file) && !empty($shared_ini_loc) && $ini_loc_dir != $shared_ini_loc && $ini_dir != $shared_ini_loc) {
$all_ini_locations_used = false;
$advice .= " Please try copying the $full_ini_loc file to " . $shared_ini_loc . ".";
} else {
if (!@file_exists($root_ini_file) && $rootpath != $shared_ini_loc && $full_ini_loc != $rootpath) {
$all_ini_locations_used = false;
$advice .= " Please try copying the $full_ini_loc file to " . $rootpath . ".";
}
if (!empty($cgibin_ini_file) && !@file_exists($cgibin_ini_file) && $cgibinpath != $shared_ini_loc && $full_ini_loc != $cgibinpath && $cgibinpath != $rootpath) {
$all_ini_locations_used = false;
$advice .= " Please try copying the $full_ini_loc file to " . $cgibinpath . ".";
}
$herepath = realpath($here);
$here_ini_file = $herepath . DIRECTORY_SEPARATOR . $ini_name;
if (!@file_exists($here_ini_file) && $herepath != $rootpath && $herepath != $cgibinpath) {
$all_ini_locations_used = false;
$advice .= " It may be necessary to copy the $full_ini_loc file to $herepath and to all " . (is_ms_windows()?'folders':'directories') . ' in which you have encoded files';
}
}
} else {
$all_ini_locations_used = false;
}
$warnings[] = $advice;
}
if ($all_ini_locations_used) {
$warnings[] = "It looks as if ini files are not being recognised in any of the standard locations in your webspace. Please contact your hosting provider to check whether you can create your own PHP ini file and where it should go.";
}
} else {
if (own_php_ini_possible(true)) {
$warnings[] = "You may not be able to create your own ini files on your shared server. You might need to ask your server administrator to install the ionCube Loader for you.";
}
}
} else {
$loader_dir_pair = correct_loader_wrong_location();
if (!empty($loader_dir_pair)) {
$advice = "The correct loader for your system has been found at ${loader_dir_pair['loader']}.";
if ($loader_dir_pair['loader'] != $loader_dir_pair['newloc']) {
$advice .= " You may wish to copy the loader from ${loader_dir_pair['loader']} to ${loader_dir_pair['newloc']}.";
}
$warnings[] = $advice;
}
}
return $warnings;
}
function list_loader_errors($errors = array(),$warnings = array(),$suggest_restart = true)
{
$default = get_default_address();
$retry_message = '';
if (empty($errors)) {
$errors = ini_loader_errors();
if (empty($warnings)) {
$warnings = ini_loader_warnings();
}
}
if (!empty($errors)) {
$try_again = 'try again';
echo '
';
if (count($errors) > 1) {
echo 'The following problems have been found with the ionCube Loader installation:';
$retry_message = "Please correct those errors and $try_again.";
} else {
echo 'The following problem has been found with the ionCube Loader installation:';
$retry_message = "Please correct that error and $try_again.";
}
if (array_key_exists(ERROR_INI_USER_CANNOT_CREATE,$errors)) {
$retry_message = '';
}
echo make_list($errors,"ul");
echo '
';
if (!empty($warnings)) {
echo '
';
echo 'Please also note the following:';
echo make_list($warnings,"ul");
echo '
';
}
} elseif (!empty($warnings)) {
echo '
';
echo 'There are the following potential problems:';
echo make_list($warnings,"ul");
echo '
Please contact your server administrator about installing the ionCube Loader.
";
} else {
if (selinux_is_enabled()) {
echo "
It appears that SELinux is enabled on your server. This might be solved by running the command restorecon [full path to loader file] as root. If that does not solve the problem then please follow the instructions at http://www.cuteshift.com/57/install-ioncube-loader-while-selinux-enabled/ for installing the ionCube Loader when SELinux is enabled.
";
} elseif (grsecurity_is_enabled()) {
echo "
It appears that grsecurity is enabled on your server. Please run the command, execstack -c [full path to loader file] and then restart your web server.
";
$lines = array();
if (is_string($loader_path)) {
$lines['Loader is at'] = $loader_path;
$loader_system = loader_system($loader_path);
if (!empty($loader_system)) {
$lines['Loader OS code'] = $loader_system['oscode'];
$lines['Loader architecture'] = $loader_system['arch'];
$lines['Loader word size'] = $loader_system['wordsize'];
$lines['Loader PHP version'] = $loader_system['php_version'];
$lines['Loader thread safety'] = $loader_system['thread_safe']?'Yes':'No';
$lines['Loader compiler'] = $loader_system['compiler'];
$lines['Loader version'] = $loader_system['loader_version'];
$lines['File size is'] = filesize($loader_path) . " bytes.";
$lines['MD5 sum is'] = md5_file($loader_path);
}
$lines['Loader file'] = "Download loader file";
} else {
$lines['Loader file'] = "Loader cannot be found.";
}
$lines['Loader found in ini file'] = empty($ini_loader_path)?"No":"Yes";
if (!empty($ini_loader_path) && (!is_string($loader_path) || $ini_loader_path != $loader_path)) {
$lines['Loader location found in ini file'] = $ini_loader_path;
$loader_system = loader_system($ini_loader_path);
if (!empty($loader_system)) {
$lines['Ini Loader OS code'] = $loader_system['oscode'];
$lines['Ini Loader architecture'] = $loader_system['arch'];
$lines['Ini Loader word size'] = $loader_system['wordsize'];
$lines['Ini Loader PHP version'] = $loader_system['php_version'];
$lines['Ini Loader thread safety'] = $loader_system['thread_safe']?'Yes':'No';
$lines['Ini Loader compiler'] = $loader_system['compiler'];
$lines['Ini Loader version'] = $loader_system['loader_version'];
}
}
$lines["OS extra security"] = (selinux_is_enabled() || possibly_selinux())?"SELinux":(grsecurity_is_enabled()?"Grsecurity":"None");
$lines['PHPRC is'] = $sys['PHPRC'];
$lines['INI DIR is'] = $sys['PHP_INI_DIR'];
$lines['Additional INI files'] = $sys['PHP_INI_ADDITIONAL'];
$stype = get_request_parameter('stype');
$server_type = find_server_type($stype);
$lines['Server type is'] = server_type_string();
$lines["PHP uname"] = $ldinf['uname'];
$lines['Server word size is'] = $ldinf['wordsize'];
$lines['Disabled functions'] = ini_get('disable_functions');
$writeable_dirs = writeable_directories();
$lines['Writeable loader locations'] = (empty($writeable_dirs))?"None":join(", ",$writeable_dirs);
if (!empty($_SESSION['hostprovider'])) {
$lines['Hosting provider'] = $_SESSION['hostprovider'];
$lines['Provider URL'] = $_SESSION['hosturl'];
}
foreach ($lines as $h => $i) {
$v = (empty($i))?'EMPTY':$i;
echo '
'. $h . ':
' . '
' . $v . '
';
}
echo "
";
footer(true);
}
function loaderbin_page()
{
info_disabled_check();
$loader_path = find_loader(true);
if (is_string($loader_path)) {
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='. basename($loader_path));
@readfile($loader_path);
}
}
function GoDaddy_root($html_root = '')
{
if (empty($_SESSION['not_go_daddy']) && empty($_SESSION['godaddy_root'])) {
$godaddy_pattern = "[\\/]home[\\/]content[\\/][0-9a-z][\\/][0-9a-z][\\/][0-9a-z][\\/][0-9a-z]+[\\/]html";
if (empty($html_root)) {
$html_root = $_SERVER['DOCUMENT_ROOT'];
}
if (preg_match("@$godaddy_pattern@i",$html_root,$matches)) {
$_SESSION['godaddy_root'] = $matches[0];
} else {
$_SESSION['not_go_daddy'] = 1;
$_SESSION['godaddy_root'] = '';
}
} elseif (!empty($_SESSION['not_go_daddy'])) {
$_SESSION['godaddy_root'] = '';
}
if (!empty($_SESSION['godaddy_root'])) {
$_SESSION['hostprovider'] = 'GoDaddy';
$_SESSION['hosturl'] = 'www.godaddy.com';
}
return $_SESSION['godaddy_root'];
}
function GoDaddy_windows_instructions()
{
$instr = "It appears that you are hosted on a Windows server at GoDaddy. ";
$instr .= "Please change to a Linux hosting plan at GoDaddy. ";
$instr .= "If you contact their support team they should be able to switch you to a Linux server.";
echo $instr;
}
function GoDaddy_linux_instructions($html_dir)
{
$base = get_base_address();
$loader_name = get_loader_name();
$zend_extension_line="zend_extension = $html_dir/ioncube/$loader_name";
$php_ini_name = is_php_version_or_greater(5,0)?'php5.ini':'php.ini';
$ini_path = $html_dir . '/' . $php_ini_name;
$instr = array();
$instr[] = 'In your html directory, ' . $html_dir . ', create a sub-directory called ioncube.';
if (@file_exists($ini_path)) {
$instr[] = "Edit the $php_ini_name in your $html_dir and add the following line to the top of the file: " . $zend_extension_line ;
} else {
$instr[] = "Save this $php_ini_name file and upload it to your html directory, $html_dir";
}
$instr[] = 'Download the Linux ionCube Loaders.';
$instr[] = 'Unzip the loaders and upload them into the ioncube directory you created previously.';
$instr[] = 'The encoded files should now be working.';
echo '