⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ioncube-loader-helper.php

📁 不错的东西
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php

//globals used by rtl tester
$working = "";
$status = "";
$instructions = "";
$already_loaded = extension_loaded('ionCube Loader');

if (!isset($HTTP_SERVER_VARS))
    $HTTP_SERVER_VARS = &$_SERVER;  
    
if (!isset($HTTP_GET_VARS))
    $HTTP_GET_VARS = &$_GET;  

//install assistant globals

//
// Determine PHP flavour
//

$php_version = phpversion();
$php_flavour = substr($php_version,0,3);


//
// Get the full name and short name for the OS
//

$os_name = substr(php_uname(),0,strpos(php_uname(),' '));
$os_code = strtolower(substr($os_name,0,3));

$dll_sfix = (($os_code == 'win') ? '.dll' : '.so');


//
// Analyse the PHP build
//

ob_start();
phpinfo(INFO_GENERAL);
$php_info = ob_get_contents();
ob_end_clean();

$thread_safe = false;
$debug_build = false;
$php_ini_path = '';


//
// Text or HTML output?
//

$cli = (php_sapi_name() == 'cli');
$nl =  ($cli ? "\n" : '<br>');


function check_safe_mode()
{
    $sm = ini_get('safe_mode');
    return ($sm=='1');
}

function getCSS()
{
	$css = "
				body, td
				{
					font-size:70%;
					font-family:verdana, helvetica, arial;
					line-height:200%;
				}

				div.main
				{
					width:80%;
					text-align:left;
					top:20px;
					position:relative;
					border:2px solid #F0F0F0;
					padding:20px;
				}

				code
				{
					font-family:courier, helvetica, arial;
				}
				table.ini_line
				{
					border:2px solid #c8e8c8;	
					background-color:white;
				}

				table.ini_line tr td
				{
					background-color:#c8e8c8;	
				}

				table.analysis
				{
					border:2px solid #e0e0ff;	
					background-color:white;
				}

				table.analysis tr td
				{
					background-color: #e0e0ff;	
				}
	";
	return $css;
}

function displayLogo()
{

	$img_encoded="R0lGODlhtAA9AMYAAN7e3ri4uBAQEMzMzKKiogAAALCwsOeope9SVvQaHPUsKfUiIvUnHPY8SeRYcsLCwuSenfNhYfMwP/ZASvU3Rv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gYSCRm3uEHKIwBzrU4ZSoTKUqT2mHOyhiAHiI5Q6CxxEyZEEYNmggw2KJhxD+gQC8JAKvCvEAIZABCSRDgh6EwBAD5CYYNjADSNDASzsCM5ZE4AIAhGADYZDBjoao5S2DkQUymMF8WCFEvVSxTkXQyxLvdES9hpnOetrznvjMpz73iZU8DEB1j/AnPznxT2MBNBQDIIM1yHDQPwzAfutzKPiWli80QHQRD1VEHhgqiITmYRJkCKku9TYIvaEhpFQ6pEKJQNJCtLQzFb3oJRIajX/+wZ+csekfLIqIARDBnx/1yuPygIaHFrWjFtXpTomH06XBS5cObSghSIr+hvK81KQJyQMRiOfToNZ0AEF96SB86hWwdkaqh4RoQq2REGuwda1b3SqV9OZThTKUrEtl6VaTulWjSvSfW+3oSos62ELstTxwLQ9PFfVQt061pH+46lIFsViHitWtHMVqlOq617YulBgr5SgkoCqIjRKjq4Hd6GQVhYaP0vWnS8UrXylbVHiRFap4naxpJRrUjrL0o6ll6GIbWNXeRnSnVnUrSyfr0wpZ47S6rGpkV9tA2db2o9LlaG4dQVqJ8qa5ER1uNF7rW+ua17blgWpleZrb7rL2uEsVb2VLKlLXFjShOxXpRR+q0MrqTbOMta5/p+tdSMy3veCdrngjitf05sJrtrFFL2OR+sKEIDit8LWofC8qVsnOl2GBjSiAq/tgDUOWpNttBE07umKPQnXE4y0whPta4gYrtrVaJR5Pd+tRDL+3uTsmLodd+tgPs7i0DCUDdq2qWxLTtsfZ9e1dQkvUz054umutaowTC1y9tnawtZVylfc61v6uVbSNypdPHXtmIRuiw0WWKVxTetLfYtmuDdwoWxNS58xKWRJNZbFxl2ZWneS0t0BVkv3++dFELyLQNy00KBg9VkmXVtKOFvRAX8lXtG7605XAaWtBTepSm/rUqE61qlfN6la7+tWwjrWsZ03rWtv61rjOta53LYlAAAA7";

	header("Content-type: image/gif");
	header("Cache-control: public");
	echo base64_decode($img_encoded);

}

function weblink($url, $display, $new_window=false)
{
  if (use_html()) {
      $extra = "";
      if ($new_window)
	  $extra = 'target="_blank"';

    return "<a href=\"$url\" $extra>$display</a>";
  } else {
    return $url;
  }
}

//
// Where are we?
//
$here = dirname(__FILE__);




//rtl tester specific functions
function echo_working($msg)
{
	global $working;
	$working.=$msg;
}

function echo_status($msg)
{
	global $status;
	$status.=$msg;
}

function echo_instructions($msg)
{
	global $instructions;
	$instructions.=$msg;
}



//
// Detect some system parameters
//
function ic_system_info()
{
  $thread_safe = false;
  $debug_build = false;
  $cgi_cli = false;
  $php_ini_path = '';

  ob_start();
  phpinfo(INFO_GENERAL);
  $php_info = ob_get_contents();
  ob_end_clean();

  foreach (split("\n",$php_info) as $line) {
    if (eregi('command',$line)) {
      continue;
    }

    if (preg_match('/thread safety.*(enabled|yes)/Ui',$line)) {
      $thread_safe = true;
    }

    if (preg_match('/debug.*(enabled|yes)/Ui',$line)) {
      $debug_build = true;
    }

    if (eregi("configuration file.*(</B></td><TD ALIGN=\"left\">| => |v\">)([^ <]*)(.*</td.*)?",$line,$match)) {
      $php_ini_path = $match[2];

      //
      // If we can't access the php.ini file then we probably lost on the match
      //
      if (!@file_exists($php_ini_path)) {
	$php_ini_path = '';
      }
    }

    $cgi_cli = ((strpos(php_sapi_name(),'cgi') !== false) ||
		(strpos(php_sapi_name(),'cli') !== false));
  }

  return array('THREAD_SAFE' => $thread_safe,
	       'DEBUG_BUILD' => $debug_build,
	       'PHP_INI'     => $php_ini_path,
	       'CGI_CLI'     => $cgi_cli);
}

function rtl_tester()
{

	global $cli;
	global $nl;
	global $working;
	global $instructions;
	global $status;
	global $already_loaded;

	$working = "";
	$status = "";
	$instructions = "";

	$ok					= true;
	$already_installed	= false;

	
	echo_working("\n");

	//
	// Is the loader already installed?
	//
	if ($already_loaded) {
	  echo_status("An ionCube Loader is already installed and run-time loading is unnecessary.\n"
.	"Encoded files should load without problems.$nl");

	  echo_instructions("If you have problems running encoded files, make sure that you select binary\n"
.			    "mode if using FTP. If unpacking files with WinZIP you must also disable the\n" 
.			    "'TAR Smart CR/LF conversion' feature.$nl$nl");
	  $already_installed = true;
	} else {
	  //
	  // Intro
	  //
	  echo_working("Testing whether your system supports run-time loading...$nl$nl");
	}



	//
	// Test some system info
	//
	$sys_info = ic_system_info();

	if (!$already_installed) {
	  if ($sys_info['THREAD_SAFE'] && !$sys_info['CGI_CLI']) {
		echo_status("Your PHP install appears to have threading support and run-time Loading\n"
	."is only possible on threaded web servers if using the CGI, FastCGI or\n"
	."CLI interface.$nl");
		echo_instructions("To run encoded files please install the Loader in the php.ini file.");
		$ok = false;
	  }

	  if ($sys_info['DEBUG_BUILD']) {
		echo_status("Your PHP installation appears to be built with debugging support\n"
.	"enabled and this is incompatible with ionCube Loaders.$nl${nl}Debugging support in PHP produces slower execution, is\n"
.	"not recommended for production builds and was probably a mistake.$nl");

		echo_instructions("You should rebuild PHP without the --enable-debug option.$nl");
		$ok = false;
	  }

	  //
	  // Check safe mode and for a valid extensions directory
	  //
	  if (check_safe_mode()) {
		echo_status("PHP safe mode is enabled and run time loading will not be possible.");
		echo_instructions(  "To run encoded files please install the Loader in the php.ini file.\n"
		.		    "Alternatively contact your hosting provider or system administrator,\n"
		.		    "and ask them to disable safe mode for your account.");
		$ok = false;
	  } 
	  /*
		elseif (!is_dir(realpath(ini_get('extension_dir')))) {
		echo "The setting of extension_dir in the php.ini file is not a directory
		or may not exist and run time loading will not be possible. You do not need
		write permissions on the extension_dir but for run-time loading to work
		a path from the extensions directory to wherever the Loader is installed
		must exist.$nl";
		$ok = false;
		}
	  */

	  // If ok to try and find a Loader
	  if ($ok) {
		//
		// Look for a Loader
		//

		// Old style naming should be long gone now
		$test_old_name = false;

		$_u = php_uname();
		$_os = substr($_u,0,strpos($_u,' '));
		$_os_key = strtolower(substr($_u,0,3));

		$_php_version = phpversion();
		$_php_family = substr($_php_version,0,3);

		$_loader_sfix = (($_os_key == 'win') ? '.dll' : '.so');

		$_ln_old="ioncube_loader.$_loader_sfix";
		$_ln_old_loc="/ioncube/$_ln_old";

		$_ln_new="ioncube_loader_${_os_key}_${_php_family}${_loader_sfix}";
		$_ln_new_loc="/ioncube/$_ln_new";

		echo_working("${nl}Looking for Loader '$_ln_new'");
		if ($test_old_name) {
		  echo_working(" or '$_ln_old'");
		}
		echo_working($nl.$nl);

		$_extdir = ini_get('extension_dir');
		if ($_extdir == './') {
		  $_extdir = '.';
		}

		$_oid = $_id = realpath($_extdir);

		$_here = dirname(__FILE__);
		if ((@$_id[1]) == ':') {
		  $_id = str_replace('\\','/',substr($_id,2));
		  $_here = str_replace('\\','/',substr($_here,2));
		}
		$_rd=str_repeat('/..',substr_count($_id,'/')).$_here.'/';

		if ($_oid !== false) {
		  echo_working("Extensions Dir: $_extdir ($_id)$nl");
		  echo_working("Relative Path:  $_rd$nl");
		} else {
		  echo_working("Extensions Dir: $_extdir (NOT FOUND)$nl$nl");

			echo_status("The directory set for the extension_dir entry in the\n"
.	"php.ini file may not exist, and run time loading will not be possible.$nl");
			echo_instructions(  "Please ask your hosting provider or system administrator to create the\n"
			.		    "directory$nl$nl"
			.		    "$_extdir$nl$nl"
			.		    "ensuring that it is accessible by the web server software. They do not\n"
			.		    "need to restart the server. Then rerun this script. As an alternative,\n"
			.		    "your host could install the Loader in the php.ini file.$nl");
		  $ok = false;
		}

		if ($ok) {
		  $_ln = '';
		  $_i=strlen($_rd);
		  while($_i--) {
		if($_rd[$_i]=='/') {
		  if ($test_old_name) {
			// Try the old style Loader name
			$_lp=substr($_rd,0,$_i).$_ln_old_loc;
			$_fqlp=$_oid.$_lp;
			if(@file_exists($_fqlp)) {
			  echo_working("Found Loader:   $_fqlp$nl");
			  $_ln=$_lp;
			  break;
			}
		  }
		  // Try the new style Loader name
		  $_lp=substr($_rd,0,$_i).$_ln_new_loc;
		  $_fqlp=$_oid.$_lp;
		  if(@file_exists($_fqlp)) {
			echo_working("Found Loader:   $_fqlp$nl");
			$_ln=$_lp;
			break;
		  }
		}
		  }

		  //
		  // If Loader not found, try the fallback of in the extensions directory
		  //
		  if (!$_ln) {
		if ($test_old_name) {
		  if (@file_exists($_id.$_ln_old_loc)) {
			$_ln = $_ln_old_loc;
		  }
		}
		if (@file_exists($_id.$_ln_new_loc)) {
		  $_ln = $_ln_new_loc;
		}

		if ($_ln) {
		  echo_working("Found Loader $_ln in extensions directory.$nl");
		}
		  }

		  echo_working($nl);

		  if ($_ln) {
		echo_working("Trying to install Loader - this may produce an error...$nl$nl");
		dl($_ln);

		if(extension_loaded('ionCube Loader')) {
		  echo_status(	"The Loader was successfully installed and encoded files should be able to\n"
.				"automatically install the Loader when needed.$nl");
		  echo_instructions( "No changes to your php.ini file\n"
.				"are required to use encoded files on this system.${nl}");
		} else {
		  echo_status("The Loader was not installed.$nl");
		} 
		  } else {
		echo_status(	"Run-time loading should be possible on your system but no suitable Loader\n"
.				"was found.$nl$nl");
		echo_instructions(	"The $_os Loader for PHP $_php_family releases is required.$nl"
.					"Loaders can be downloaded from " . weblink("http://www.ioncube.com/loaders.php","www.ioncube.com"));
		  }
		}
	  }
	}

	//$instructions should never be empty.
	//if it is, then put default:
	if (empty($instructions))
	{	
		$instructions = "Run-time loading is not currently possible.$nl"
		.				"If you require further assistance, please contact ionCube support providing${nl}a link to this script.";
	}

	if ($cli)
	{
		return "$working$status$instructions\n";
	}
	else
	{

		//echo "${nl}Please send the output of this script to $email if you have questions or require further assistance.$nl$nl";

		$body = "<center><h2>Run-Time Loading Installation Instructions</h2></center>"
		.		"<h3>Testing Server</h3>"
		.		"$working"
		.		"<h3>Results</h3>"
		.		"$status"
		.		"<h3>Instructions</h3>"
		.		$instructions;

		return $body;

	}
}
//END OF RTL-TESTER FUNCTIONS

//BEGIN INSTALL ASSISTANT RELATED FUNCTIONS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -