78 lines
2.2 KiB
PHP
78 lines
2.2 KiB
PHP
<?
|
|
define ('DATETIME', date('YmdHis'));
|
|
define ('DATE', substr(DATETIME,0,8));
|
|
define ('TIME', substr(DATETIME,8,6));
|
|
define ('DATE_LISIBLE', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
|
|
define ('TIME_LISIBLE', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
|
|
|
|
/**
|
|
* Inclusion du fichier de configuration des includes Métiers de S&D
|
|
*/
|
|
include_once realpath(dirname(__FILE__).'/config.php');
|
|
|
|
/**
|
|
* Inclusion du Framework
|
|
*/
|
|
if( !defined('FWK_PATH') )
|
|
include_once realpath(dirname(__FILE__).'/../framework/fwk.php');
|
|
|
|
|
|
|
|
/** Instance de la connexion à la base de données
|
|
* Cette instance est utilisée par tous les scripts pour accéder à la base de données
|
|
*//*
|
|
class DB extends DB_sql
|
|
{
|
|
function DB() {
|
|
$this->Host = MYSQL_HOST;
|
|
$this->Database = MYSQL_DEFAULT_DB;
|
|
$this->User = MYSQL_USER;
|
|
$this->Password = MYSQL_PASS;
|
|
}
|
|
|
|
function getRow() {
|
|
$ret= $this->Record;
|
|
for( $i= 0; $i<count($this->Record); $i++ ) { if( !isset($ret[$i]) ) break; unset($ret[$i]); }
|
|
return $ret;
|
|
}
|
|
|
|
function query($q) {
|
|
if ( MYSQL_SQL_LOG != 'NONE' ) $time_start=getmicrotime();
|
|
|
|
$ret=DB_sql::query($q);
|
|
|
|
if ( MYSQL_SQL_LOG == 'NONE' ) return $ret;
|
|
|
|
$time_end= getmicrotime();
|
|
$time_total= $time_end-$time_start;
|
|
$time_total= substr((string)$time_total,0,10);
|
|
$now= date('Y/m/d H:i:s', $time_start);
|
|
if ($ret<1)
|
|
$mysqlerror = mysql_errno() .' : '. mysql_error();
|
|
else
|
|
$mysqlerror = '';
|
|
|
|
$sqlAction=strtoupper(substr(trim($q),0,6));
|
|
if ( MYSQL_SQL_LOG=='SELECT' && $sqlAction=='SELECT' )
|
|
$logOption='_select';
|
|
elseif ( MYSQL_SQL_LOG=='UPDATE' && ( $sqlAction=='UPDATE' || $sqlAction=='INSERT' || $sqlAction=='DELETE' ) )
|
|
$logOption='_update';
|
|
else
|
|
$logOption='';
|
|
|
|
$fh=@fopen(REP_TEMP . 'db_mysql'.$logOption.'.log', 'a+');
|
|
if ($fh) {
|
|
@fwrite($fh, "$now\t$time_total\t" . MYSQL_HOST ."\t". MYSQL_USER ."\t". MYSQL_DB ."\t$mysqlerror\t$q\r\n");
|
|
@fclose($fh);
|
|
}
|
|
|
|
$mySqlErrTab=explode(' : ', $mysqlerror);
|
|
$mySqlErrno=(int)$mySqlErrTab[0];
|
|
if ( $mySqlErrno > 0 && $mySqlErrno !=1062 ) {
|
|
mail( 'Erreur MySQL '.$mySqlErrno, $mysqlerror ."\n\n". $q );
|
|
}
|
|
|
|
return $ret;
|
|
}
|
|
}*/
|
|
?>
|