HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/baretube.com.new/admin/cli/settings.php
<?
require("../../mb.php");
if ($argv[1]) {
    foreach ($argv as $arg) {
        $e = explode("=", $arg);
        if (count($e) == 2) {
            $command = $e[0];
			$param = $e[1];
        } else {
            $command = $e[0];
        }
    }
}
if(!$command) { 
	exit("Usage: php settings.php list OR php settings.php setting=value.\nExample: php settings.php cacheType=memcached\n"); 
}

if($command == 'list') { 
	$result = dbQuery("SELECT * FROM configuration ORDER BY weight ASC, `group` ASC");
	foreach($result as $row) { 
		if($row['data']) { 
			$type = $row['data']; 
		} else { 
			$type = 'string';
		}
		echo "- $row[field] : $row[value] ($type)\n";
	}
}

if($command && $param) { 
	if(mysqli_query($dbconn,"UPDATE `configuration` SET `value` = '".mysqli_real_escape_string($dbconn,trim($param))."' WHERE `field` = '".mysqli_real_escape_string($dbconn,trim($command))."'")) { 
		$output = array();
		$results = dbQuery("SELECT * FROM `configuration`", false);
		foreach ($results as $row) {
			$output[$row['field']] = $row['value'];
		}
		if(file_put_contents("$basepath/admin/scripts/config.json", json_encode($output))) { 
			exit("Configuration saved! ($command:$param)\n");
		} else { 
			exit("Could not write to admin/scripts/config.json.\n"); 
		}
	} else { 
		exit("Could not write to db.\n"); 
	}
}