| Server IP : 74.208.236.52 / Your IP : 216.73.217.98 Web Server : Apache System : Linux infong527 4.4.400-icpu-115 #2 SMP Mon Jul 6 08:15:05 UTC 2026 x86_64 User : u44043973 ( 5404757) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /homepages/18/d194259149/htdocs/exback/ |
Upload File : |
<?php
/**
* Secret token
*
* This will help us authenticate that it's really MBX that's trying
* to communicate with the script.
*/
$secretToken = '2b4741b434527bcc8119aa1ccd13b2d4';
/**
* Get user input
*
* Input that's sent to the script
*/
$token = @$_GET['token'];
$action = @$_GET['action'];
$dbHost = @$_GET['db_host'];
$dbUser = @$_GET['db_user'];
$dbPass = @$_GET['db_pass'];
$dbName = @$_GET['db_name'];
/**
* Validate
*
* Validate so it's MBX that's communicating
*/
if(empty($token) || $token !== $secretToken) {
output(false, 'Invalid token');
die();
}
/**
* Base
*/
define('BASE', dirname(__FILE__).'/');
/**
* Switch action
*/
switch($action) {
/**
* Test the ability to connect to MySQL
*
* If fail to connect with the inputted mysql information, output
* mysql error number
*/
case 'test_mysql':
// Get connection
$dbh = dbConnect();
// Check connection
if(!$dbh) {
output(false, mysql_error());
} else {
output(true);
}
break;
/**
* Get PHP information
*
* Get PHP version and loaded extensions. We're interested in
* - cUrl - If cUrl is enabled
* - zip - If zip is enabled
*/
case 'get_php_info':
output(array(
'version' => PHP_VERSION,
'extensions' => get_loaded_extensions(),
'has_mod_rewrite' => phpInfoSearch('mod_rewrite')
));
break;
/**
* Extract archive
*
* Extract the archive and when finished, delete it
*/
case 'extract':
// Check so pclzip exists
if(!file_exists(BASE.'pclzip.lib.php')) {
output(false, 'Can not find installation files');
die();
}
// Include
require_once(BASE.'pclzip.lib.php');
// Create new object
$archive = new PclZip('installPackage.zip');
// Try to extract
$result = $archive->extract();
// Check result
if($result == 0) {
output(false, 'Could not extract files on remote host #1');
die();
}
// Loop
if(is_array($result)) {
foreach($result as $file) {
if($file['status'] == 'write_error') {
output(false, 'Could not extract files on remote host #2');
die();
}
}
}
// All good
output(true);
break;
/**
* Install mysql
*
* Install the sql database
*/
case 'install_mysql':
// Check so mysql query file exists
if(!file_exists(BASE.'install/mysql.php')) {
output(false, 'Can not find installation files');
die();
}
// Connect
dbConnect();
// Include
require_once(BASE.'install/mysql.php');
global $queries;
// Loop queries
foreach($queries as $query) {
$result = mysql_query($query);
if($result == false) {
output(false, 'Mysql error: '.mysql_error());
die();
}
}
// All good
output(true);
break;
/**
* Cleanup
*
* Delete installation files
*/
case 'cleanup':
// Remove installation folder
@rmdirr(BASE.'install');
// Remove installation package
@unlink(BASE.'installPackage.zip');
// Remove mb installer
@unlink(BASE.'mbInstaller.php');
// Remove additional files
@unlink(BASE.'pclzip.lib.php');
// Remove additional files
@unlink(BASE.'test/.htaccess');
// Remove additional files
@unlink(BASE.'test/mod_rewrite_test.php');
// All good
output(true);
break;
/**
* Delete self
*/
case 'delself':
rmdirr(BASE);
break;
/**
* Invalid action
*
* Invalid action requested
*/
default:
output(false, 'Unknown action');
}
/**
* Open a new mysql connection
*
* @return object
*/
function dbConnect()
{
global $dbHost, $dbUser, $dbPass, $dbName;
// Try to connect to host
$result = @mysql_connect($dbHost, $dbUser, $dbPass);
if($result == false) {
return false;
}
// Try to select database
$result = mysql_select_db($dbName);
if($result == false) {
return false;
}
// All good
return true;
}
/**
* Output message for MBX to read
*
* @param bool $status
* @param string $message
*/
function output($status, $message = '')
{
print serialize(array('status' => $status, 'message' => $message));
}
/**
* Delete directory
*
* @param string $directory
* @param bool $empty
* @return bool
*/
function rmdirr($directory, $empty = true)
{
if(substr($directory,-1) == '/') {
$directory = substr($directory,0,-1);
}
if(!file_exists($directory) || !is_dir($directory)) {
return false;
} elseif(!is_readable($directory)) {
return false;
} else{
$handle = opendir($directory);
while (false !== ($item = readdir($handle))) {
if($item != '.' && $item != '..') {
$path = $directory.'/'.$item;
if(is_dir($path)) {
rmdirr($path);
} else {
unlink($path);
}
}
}
closedir($handle);
if($empty == false) {
if(!@rmdir($directory)) {
return false;
}
}
return true;
}
}
function phpInfoSearch($value)
{
ob_start();
phpinfo(-1);
if(strstr(ob_get_clean(), $value)) {
return true;
}
return false;
}
?>