|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/logmcpe/www/TEST/www/../../MC/includes/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
if ( empty ( $PHP_SELF ) && ! empty ( $_SERVER ) &&
! empty ( $_SERVER['PHP_SELF'] ) ) {
$PHP_SELF = $_SERVER['PHP_SELF'];
}
if ( ! empty ( $PHP_SELF ) && preg_match ( "/\/includes\//", $PHP_SELF ) ) {
die ( "You can't access this file directly!" );
}
// Enable the following to show the actual database error in the browser.
// It is more secure to not show this info, so this should only be turned
// on for debugging purposes.
$phpdbiVerbose = false;
/**
* Opens up a database connection.
*
* Use a pooled connection if the db supports it and
* the <var>db_persistent</var> setting is enabled.
*
* <b>Notes:</b>
* - The database type is determined by the global variable
* <var>db_type</var>
* - For ODBC, <var>$host</var> is ignored, <var>$database</var> = DSN
* - For Oracle, <var>$database</var> = tnsnames name
* - Use the {@link dbi_error()} function to get error information if the connection
* fails
*
* @param string $host Hostname of database server
* @param string $login Database login
* @param string $password Database login password
* @param string $database Name of database
*
* @return resource The connection
*/
function dbi_connect ( $host, $login, $password, $database ) {
$c = new mysqli($host, $login, $password, $database);
if ($c->connect_error) {
die("Connection failed: " . $c->connect_error);
return false;
}
// $c->set_charset("utf8");
return $c;
}
function dbi_close ( $conn ) {
return mysqli_close ( $conn );
}
function mysql_numrows ( $conn ) {
return mysqli_num_rows ( $conn );
}
/**
* Executes a SQL query.
*
* <b>Note:</b> Use the {@link dbi_error()} function to get error information
* if the connection fails.
*
* @param string $sql SQL of query to execute
* @param bool $fatalOnError Abort execution if there is a database error?
* @param bool $showError Display error to user (including possibly the
* SQL) if there is a database error?
*
* @return mixed The query result resource on queries (which can then be
* passed to the {@link dbi_fetch_row()} function to obtain the
* results), or true/false on insert or delete queries.
*/
function dbi_query ( $sql, $fatalOnError=true, $showError=true ) {
global $conn;
$res = $conn->query($sql);
return $res;
}
// Determine the number of rows from a result
//function dbi_num_rows ( $res ) {
// if ( strcmp ( $GLOBALS["db_type"], "mysql" ) == 0 ) {
// return mysql_num_rows ( $res );
// } else {
// dbi_fatal_error ( "dbi_num_rows(): db_type not defined." );
// }
//}
/**
* Retrieves a single row from the database and returns it as an array.
*
* <b>Note:</b> We don't use the more useful xxx_fetch_array because not all
* databases support this function.
*
* <b>Note:</b> Use the {@link dbi_error()} function to get error information
* if the connection fails.
*
* @param resource $res The database query resource returned from
* the {@link dbi_query()} function.
*
* @return mixed An array of database columns representing a single row in
* the query result or false on an error.
*/
function dbi_fetch_row ( $res ) {
$row = $res->fetch_array(MYSQLI_BOTH);
return $row;
}
function tep_db_error($query, $errno, $error) {
global $HTTP_REFERER, $send_mail_on_db_error;
$debug = debug_backtrace();
if (!empty($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] == '82.66.211.152') {
/* die(*/echo('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');
}
}
/**
* Returns the number of rows affected by the last INSERT, UPDATE or DELETE.
*
* <b>Note:</b> Use the {@link dbi_error()} function to get error information
* if the connection fails.
*
* @param resource $conn The database connection
* @param resource $res The database query resource returned from
* the {@link dbi_query()} function.
*
* @return int The number or database rows affected.
*/
function dbi_affected_rows ( $conn, $res ) {
return mysqli_affected_rows ( $conn );
}
/**
* Frees a result set.
*
* @param resource $res The database query resource returned from
* the {@link dbi_query()} function.
*
* @return bool True on success
*/
function dbi_free_result ( $res ) {
return mysqli_free_result ( $res );
}
/**
* Gets the latest database error message.
*
* @return string The text of the last database error. (The type of
* information varies depending on the which type of database
* is being used.)
*/
function dbi_error () {
$ret = mysqli_error ();
$stack = debug_backtrace() ;
$file = sprintf("<br>Fichier : %s<br>Ligne : %s", $stack[1]['file'], $stack[1]['line']) ;
if ( strlen ( $ret ) )
return $ret.$file;
else
return "Unknown error".$file;
}
/**
* Displays a fatal database error and aborts execution.
*
* @param string $msg The database error message
* @param bool $doExit Abort execution?
* @param bool $showError Show the details of the error (possibly including
* the SQL that caused the error)?
*/
function dbi_fatal_error ( $msg, $doExit=true, $showError=true ) {
if ( $showError ) {
echo "<h2>Error</h2>\n";
echo "<!--begin_error(dbierror)-->\n";
echo "$msg\n";
echo "<!--end_error-->\n";
}
if ( $doExit )
exit;
}
?>
