ÿØÿà JFIF  ` ` ÿþš 403 WEBHELL REBORN
403 WEBHELL REBORN
Server : Apache
System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : tkt_travelbus ( 1137)
PHP Version : 7.0.0p1
Disable Function : mysql_pconnect
Directory :  /tkt_travelbus/www/Lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/Lib/class.Debug.php
<?php
/**
 * Debug Class (static)
 * 
 * @since 2008-04-25
 */
class Debug
{
	public static $index = -1;

	/**
	 * error for debugging
	 *
	 * @param mixed $msg
	 * @return void
	 */
	function error($msg)
	{
		$charset = getConf('site.charset');
		if ($charset) {
			@header('Content-type: text/html; charset=' . $charset);
		}

		echo '<h2><fontcolor="red">ERROR</font></h2>';
		Debug::dump($msg, 'ERROR');
		Debug::trace('ERROR');
	}

	/**
	 * error for debugging / ajax safe
	 *
	 * @param mixed $msg
	 * @return void
	 */
	function ajaxError($msg)
	{
		ob_start();
		echo "ERROR : " . $msg . "\n\n";
		print_r(debug_backtrace());
		$output = ob_get_contents();
		ob_end_clean();

		return $output;
	}

	/**
	 * debug output
	 *
	 * @param mixed $msg
	 * @return void
	 */
	function output($msg, $desc = '')
	{
		global $__debug_output, $__debug_query;

		self::$index++;

		ob_start();
		//echo '<br><hr color="#FF7777">';

		if (is_string($msg) && (strtoupper($desc)=='QUERY' || in_array(Debug::getQueryCommand($msg), array('SELECT','INSERT','UPDATE','DELETE'))) ) {
			if (!is_array($__debug_query)) {
				$__debug_query = array();
			}
			$__debug_query[self::$index] = str_replace(array("\n", "\r"), array("\\n", ''), $msg);
			$query = $msg;
			$desc = 'QUERY';
		}
		$ptns = array(
			'/^(WRITE|READ) Query Error : (.+) ===> (.+)/',
			"/^(WRITE|READ) Query : \/\*([0-9\.]+)sec\*\/ (.+)/"
		);
		foreach ( $ptns as $p ){
			$matches = array();
			if ( is_string($msg) && preg_match($p, $msg, $matches) ){
				if (!is_array($__debug_query)) {
					$__debug_query = array();
				}
				if (is_numeric($matches[2]) && $matches[2] > 0.1) {
					$msg = '<strong style="color:red;">' . $msg . '</strong>';
				}
				$__debug_query[self::$index] = str_replace(array("\n", "\r"), array("\\n", ''), $matches[3]);
				//Debug::explainQuery($matches[3]);
				$query = $matches[3];
				$desc = 'QUERY';
			}
		}

		Debug::dump($msg, $desc);
		if ( strtoupper($desc)=='QUERY' ) {
			Debug::explainQuery($query);
		}

		Debug::trace();
		$__debug_output[self::$index] = ob_get_contents();
		ob_end_clean();
	}

	/**
	 * debug dump
	 *
	 * @param mixed $var
	 * @return void
	 */
	public static function dump($var, $desc = '')
	{
		if ($desc == 'ERROR') {
			$index = 'ERROR';
		} else {
			$index = self::$index;
		}

		echo '<div id="__debug_output_' . $index . '" style="margin:10px 0; padding:5px 20px; cursor:pointer;" onclick="var obj=document.getElementById(this.id + \'_trace\'); obj.style.display=(obj.style.display==\'none\')?\'block\':\'none\';" onmouseover="this.style.backgroundColor=\'#CCDDFF\';" onmouseout="this.style.backgroundColor=\'\';">';
		if ($desc != 'ERROR') {
			echo '<b style="color:blue;">[' . $index . '] </b>';
			if ($desc) {
				echo '<span style="color:red;">' . $desc . ' : </span>';
			}
		}

		if (is_array($var) || is_object($var)) {
			// script error safe
			$str = htmlspecialchars(print_r($var, true));

			if ($pos = strpos($str, "\n")) {
				$type = substr($str, 0, $pos);
			} else {
				$type = $str;
			}
			if (is_array($var)) {
				$type .= ' : ' . count($var);
			}
			$id = '__debug_output_' . $index;
			echo '<input id="' . $id . '_button" type="button" value="' . $type . '" onclick="var obj=document.getElementById(\'' . $id . '_data\'); obj.style.display=(obj.style.display==\'none\')?\'block\':\'none\';">';
			echo '<div id="' . $id . '_data" style="display:none;" onclick="this.style.display=\'none\'; document.getElementById(\'' . $id . '_button\').scrollIntoView();">';
			echo '<pre>';
			echo $str;
			echo '</pre>';
			echo '</div>';
		} else if ($var && !is_bool($var)) {
			//$var = htmlspecialchars((string)$var);
			echo '<b>' . $var . '</b>';
		} else {
			echo '<b>';
			echo var_dump($var);
			echo '</b>';
		}
		echo '</div>';
	}

	/**
	 * debug back trace
	 *
	 * @param mixed $msg
	 * @return void
	 */
	public static function trace($desc = '')
	{
		if ($desc == 'ERROR') {
			$index = 'ERROR';
		} else {
			$index = self::$index;
		}

		if (!$trace) {
			$trace = debug_backtrace();
		}

		echo "\n";
		echo '<div id="__debug_output_' . $index . '_trace" style="border:0px solid #333377; margin:10px; padding:10px; background-color:#EEEEFF; display:none;">' . "\n";
		$idx = 0;
		foreach ($trace as $value) {
			if ($value['class'] == 'Debug') {
				continue;
			}

			$idx++;
			isset($value['args']) || $value['args'] = array();
			$tmp = array();
			foreach ($value['args'] as $arg) {
				$strArg = print_r($arg, true);
				if (strlen($strArg) > 30) {
					$tmp[] = htmlspecialchars(str_replace("\n", ' ', substr($strArg, 0, 30))) . '..';
				} else {
					$tmp[] = htmlspecialchars(str_replace("\n", ' ', $strArg));
				}
			}
			$strArgs = print_r($value['args'], true);
			if (isset($value['type'])) {
				$funcCall = $value['class'] . $value['type'] . $value['function'];
			} else {
				$funcCall = $value['function'];
			}
			$strArgs = $funcCall . substr($strArgs, 5);
			echo '#' . $idx . ' &nbsp; ';
			echo $funcCall . ' <b>(</b> ';
			if ($value['args']) {
				echo '<a href="#" onclick="if(typeof console===\'undefind\'){alert(this.nextSibling.value);}else{console.log(this.nextSibling.value);} return false;">' . implode(' , ', $tmp) . '</a><textarea style="display:none;">' . htmlspecialchars($strArgs) . '</textarea>';
			}
			echo ' <b>)</b> ';

			if (isset($value['file'])) {
				$value['file'] = str_replace('\\', '/', $value['file']);
				echo '<font color="#333399">[ ';
				echo str_replace(getConf('dir.root'), '', $value['file']);
				echo ' : ';
				echo '<b>' . $value['line'] . '</b>';
				echo ' ]</font>';
			}
			echo '<br>' . "\n";
		}
		echo '</div>';
	}

	/**
	 * debug log
	 * 
	 * @param string $msg
	 * @param boolean $trace
	 * @return void
	 */
	function log($msg, $trace = true)
	{
		$logDir = getConf('dir.log');
		if (!is_dir($logDir)) {
			@mkdir($logDir);
			@chmod($logDir, 0707);
		}

		ob_start();
		echo str_repeat('-', 80) . "\n";
		echo date('Y-m-d H:i:s') . " (".$_SERVER['REMOTE_ADDR']." " . COUNTRY_CODE . ") " . $_SERVER['PHP_SELF'] . "\n";
		echo "HTTP_USER_AGENT : " . $_SERVER['HTTP_USER_AGENT'] . "\n";
		echo "HTTP_REFERER : " . $_SERVER['HTTP_REFERER'] . "\n\n";
		if ($trace) {
			debug_print_backtrace();
		}
		echo "\n";
		if ($msg) {
			if (is_string($msg) || is_numeric($msg)) {
				echo $msg;
			} else {
				print_r($msg);
			}
		} else {
			var_dump($msg);
		}
		echo "\n\n";
		$str = ob_get_contents();
		ob_end_clean();

		$logFile = $logDir . '/' . getConf('debug.log.file');
		$str = str_replace("\r", '', $str);
		file_put_contents($logFile, $str, FILE_APPEND);
		@chmod($logFile, 0606);
	}

	/**
	 * explain select query
	 * 
	 * @param string $query
	 * @return void
	 */
	public static function queryInfo($query)
	{
		$query = trim($query);
		$type = Debug::getQueryCommand($query);
		if ($type == 'SELECT') {
			$r = @mysql_query('EXPLAIN ' . $query);
			if ($r) {
				$data = array();
				while ($row = @mysql_fetch_assoc($r)) {
					$data[] = $row;
				}
				return $data;
			}
		} else if ($type == 'INSERT') {
			return 'Insert ID : ' . mysql_insert_id();
		} else {
			return 'Affected Rows : ' . mysql_affected_rows();
		}
	}
	public static function getQueryCommand($query)
	{
		// http://stackoverflow.com/questions/7100127/regex-to-match-mysql-comments
		$sqlComments = '@(([\'"`]).*?[^\\\]\2)|((?:\#|--).*?$|/\*(?:[^/*]|/(?!\*)|\*(?!/)|(?R))*\*\/)\s*|(?<=;)\s+@ms';
		$uncommentedSQL = trim( preg_replace( $sqlComments, '$1', trim($query) ) );
		$uncommentedSQL = preg_replace("/[\s]+/", ' ', $uncommentedSQL);
		return strtoupper(substr($uncommentedSQL, 0, strpos($uncommentedSQL, ' ')));
	}

	/**
	 * explain select query
	 * 
	 * @param string $query
	 * @return void
	 */
	function explainQuery($query, $html = true)
	{
		$info = Debug::queryInfo($query);

		echo '<div style="margin:5px 20px;">';
		if (is_array($info)) {
			$table = array();
			foreach ($info as $key=>$val) {
				if (!$table) {
					$table[] = '<tr align="center"><td style="border:1px solid black;padding:2px;">' . implode('</td><td style="border:1px solid black;padding:2px;">', array_keys($val)) . '</td></tr>';
				}
				$val['table'] = htmlspecialchars($val['table']);
				if ($val['type'] == 'ALL') {
					$val['type'] = '<b><font color="#FF0000">' . $val['type'] . '</font></b>';
				} else {
					$val['type'] = '<b><font color="#0000FF">' . $val['type'] . '</font></b>';
				}
				$val['key'] = '<b><font color="green">' . $val['key'] . '</font></b>';
				$val['Extra'] = preg_replace(array('/(Using (index))/i', '/(Using (filesort|temporary))/i'), array('<b><font color="#0000FF">$1</font></b>', '<b><font color="#FF0000">$1</font></b>'), $val['Extra']);
				$table[] = '<tr><td style="border:1px solid black;padding:2px;">' . implode('</td><td style="border:1px solid black;padding:2px;">', array_values($val)) . '</td></tr>';;
			}

			echo '<table border="1" cellpadding="5" style="border-collapse:collapse;">' . implode('', $table) . '</table>';
		} else {
			echo '<b style="color:red;">' . $info . '</b>';
		}
		echo '</div>';
	}
}
?>

Anon7 - 2021