Mise à jour des fichiers de config
This commit is contained in:
parent
d4d7832a00
commit
f7b9ac32f8
@ -12,7 +12,7 @@
|
||||
define ('MYSQL_HOST', 'localhost');
|
||||
define ('MYSQL_DB', 'sdv1');
|
||||
define ('MYSQL_USER', 'root');
|
||||
define ('MYSQL_PASS', 'catsysyo92');
|
||||
define ('MYSQL_PASS', 'Cs03dfCN');
|
||||
|
||||
//define ('PATH_SITE', 'C:\\wamp\\www\\extranet\\');
|
||||
define ('PATH_SITE', realpath(dirname(__FILE__) . '/../'));
|
||||
|
134
config/prepend-server.php
Normal file
134
config/prepend-server.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fonction globale récupérant le microtime de la machine en format float.
|
||||
* @return float Valeur courante du microtime() de la machine en format décimal
|
||||
*/
|
||||
function getmicrotime(){
|
||||
list($usec, $sec) = explode (' ', microtime());
|
||||
return ( (float)$sec + (float)$usec );
|
||||
}
|
||||
/**********************************************************************
|
||||
* Ce script est chargé par tous les scripts PHP
|
||||
**********************************************************************
|
||||
* $Id: $
|
||||
* $Author: $
|
||||
* $Revision: $
|
||||
**********************************************************************/
|
||||
|
||||
/** On ne prend l'heure qu'une seule fois par script PHP et on initialise des constantes.
|
||||
*
|
||||
* DATETIME YmdHis
|
||||
* DATETIME_LOG Y-m-d H:i:s Date du jour pour les insertions en BDD
|
||||
* NOW His Heure d'exécution du script
|
||||
* NOW_FORMAT H:i:s Heure d'exécution du script
|
||||
* TODAY Ymd Année, Mois, Jour d'ex�cution du script
|
||||
* TODAY_FORMAT Y-m-d
|
||||
* TODAY_AFF d/m/Y
|
||||
*/
|
||||
define ('DATETIME', date('YmdHis'));
|
||||
define ('DATETIME_LOG', substr(DATETIME,0,4).'-'.substr(DATETIME, 4,2).'-'.substr(DATETIME, 6,2).' '.substr(DATETIME,8,2).'-'.substr(DATETIME,10,2).'-'.substr(DATETIME,12,2) );
|
||||
define ('TODAY', substr(DATETIME,0,8));
|
||||
define ('NOW', substr(DATETIME,8,6));
|
||||
define ('TODAY_FORMAT', substr(DATETIME,0,4).'-'.substr(DATETIME,4,2).'-'.substr(DATETIME,6,2));
|
||||
define ('TODAY_AFF', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
|
||||
define ('NOW_FORMAT', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
|
||||
|
||||
/**
|
||||
* Les librairies suivantes sont chargées automatiquement car tous les scripts les utilisent !
|
||||
*/
|
||||
if( !defined('ROOT_PATH') )
|
||||
{
|
||||
define ('ROOT_PATH', realpath(dirname(__FILE__) . '/../') );
|
||||
define ('WWW_PATH', realpath(ROOT_PATH.'/www/') );
|
||||
define ('LOG_PATH', realpath(ROOT_PATH.'/log/') );
|
||||
define ('INCLUDE_PATH', realpath(ROOT_PATH.'/includes/') );
|
||||
define ('PEAR_PATH', realpath('/usr/share/php/') );
|
||||
|
||||
include_once realpath(INCLUDE_PATH.'/phplib/db_mysql.inc');
|
||||
include_once realpath(INCLUDE_PATH.'/auth/sessions.inc');
|
||||
//include_once realpath(INCLUDE_PATH.'/auth/sessions.local.inc');
|
||||
include_once realpath(ROOT_PATH.'/config/config.inc');
|
||||
}
|
||||
|
||||
/*
|
||||
if ( LOG_BENCH != 'NONE' ){
|
||||
include_once realpath(PEAR_PATH . '/Benchmark/Timer.php');
|
||||
}else{
|
||||
class Benchmark_Timer
|
||||
{
|
||||
function start() {}
|
||||
function setMarker() {}
|
||||
function stop() {}
|
||||
function getProfiling() {}
|
||||
function display() {}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* @todo: A enlever pour la prod
|
||||
$timer = new Benchmark_Timer();
|
||||
$timer->start();
|
||||
$timer->setMarker('Debut du script (prepend.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_MySQL
|
||||
{
|
||||
function DB() {
|
||||
$this->Host = MYSQL_HOST;
|
||||
$this->Database = MYSQL_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 ( LOG_MYSQL != 'NONE' ) $time_start=getmicrotime();
|
||||
|
||||
$ret=DB_MySQL::query($q);
|
||||
|
||||
if ( LOG_MYSQL == '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 ( LOG_MYSQL=='SELECT' && $sqlAction=='SELECT' )
|
||||
$logOption='_select';
|
||||
elseif ( LOG_MYSQL=='UPDATE' && ( $sqlAction=='UPDATE' || $sqlAction=='INSERT' || $sqlAction=='DELETE' ) )
|
||||
$logOption='_update';
|
||||
else
|
||||
$logOption='';
|
||||
|
||||
$fh=@fopen( LOG_PATH . '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_admin( 'Erreur MySQL '.$mySqlErrno, $mysqlerror ."\n\n". $q );
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
134
config/prepend-serverdev.php
Normal file
134
config/prepend-serverdev.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fonction globale récupérant le microtime de la machine en format float.
|
||||
* @return float Valeur courante du microtime() de la machine en format décimal
|
||||
*/
|
||||
function getmicrotime(){
|
||||
list($usec, $sec) = explode (' ', microtime());
|
||||
return ( (float)$sec + (float)$usec );
|
||||
}
|
||||
/**********************************************************************
|
||||
* Ce script est chargé par tous les scripts PHP
|
||||
**********************************************************************
|
||||
* $Id: $
|
||||
* $Author: $
|
||||
* $Revision: $
|
||||
**********************************************************************/
|
||||
|
||||
/** On ne prend l'heure qu'une seule fois par script PHP et on initialise des constantes.
|
||||
*
|
||||
* DATETIME YmdHis
|
||||
* DATETIME_LOG Y-m-d H:i:s Date du jour pour les insertions en BDD
|
||||
* NOW His Heure d'exécution du script
|
||||
* NOW_FORMAT H:i:s Heure d'exécution du script
|
||||
* TODAY Ymd Année, Mois, Jour d'ex�cution du script
|
||||
* TODAY_FORMAT Y-m-d
|
||||
* TODAY_AFF d/m/Y
|
||||
*/
|
||||
define ('DATETIME', date('YmdHis'));
|
||||
define ('DATETIME_LOG', substr(DATETIME,0,4).'-'.substr(DATETIME, 4,2).'-'.substr(DATETIME, 6,2).' '.substr(DATETIME,8,2).'-'.substr(DATETIME,10,2).'-'.substr(DATETIME,12,2) );
|
||||
define ('TODAY', substr(DATETIME,0,8));
|
||||
define ('NOW', substr(DATETIME,8,6));
|
||||
define ('TODAY_FORMAT', substr(DATETIME,0,4).'-'.substr(DATETIME,4,2).'-'.substr(DATETIME,6,2));
|
||||
define ('TODAY_AFF', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
|
||||
define ('NOW_FORMAT', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
|
||||
|
||||
/**
|
||||
* Les librairies suivantes sont chargées automatiquement car tous les scripts les utilisent !
|
||||
*/
|
||||
if( !defined('ROOT_PATH') )
|
||||
{
|
||||
define ('ROOT_PATH', realpath(dirname(__FILE__) . '/../') );
|
||||
define ('WWW_PATH', realpath(ROOT_PATH.'/www/') );
|
||||
define ('LOG_PATH', realpath(ROOT_PATH.'/log/') );
|
||||
define ('INCLUDE_PATH', realpath(ROOT_PATH.'/includes/') );
|
||||
define ('PEAR_PATH', realpath('/usr/share/php/') );
|
||||
|
||||
include_once realpath(INCLUDE_PATH.'/phplib/db_mysql.inc');
|
||||
include_once realpath(INCLUDE_PATH.'/auth/sessions.inc');
|
||||
//include_once realpath(INCLUDE_PATH.'/auth/sessions.local.inc');
|
||||
include_once realpath(ROOT_PATH.'/config/config.inc');
|
||||
}
|
||||
|
||||
/*
|
||||
if ( LOG_BENCH != 'NONE' ){
|
||||
include_once realpath(PEAR_PATH . '/Benchmark/Timer.php');
|
||||
}else{
|
||||
class Benchmark_Timer
|
||||
{
|
||||
function start() {}
|
||||
function setMarker() {}
|
||||
function stop() {}
|
||||
function getProfiling() {}
|
||||
function display() {}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/* @todo: A enlever pour la prod
|
||||
$timer = new Benchmark_Timer();
|
||||
$timer->start();
|
||||
$timer->setMarker('Debut du script (prepend.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_MySQL
|
||||
{
|
||||
function DB() {
|
||||
$this->Host = MYSQL_HOST;
|
||||
$this->Database = MYSQL_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 ( LOG_MYSQL != 'NONE' ) $time_start=getmicrotime();
|
||||
|
||||
$ret=DB_MySQL::query($q);
|
||||
|
||||
if ( LOG_MYSQL == '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 ( LOG_MYSQL=='SELECT' && $sqlAction=='SELECT' )
|
||||
$logOption='_select';
|
||||
elseif ( LOG_MYSQL=='UPDATE' && ( $sqlAction=='UPDATE' || $sqlAction=='INSERT' || $sqlAction=='DELETE' ) )
|
||||
$logOption='_update';
|
||||
else
|
||||
$logOption='';
|
||||
|
||||
$fh=@fopen( LOG_PATH . '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_admin( 'Erreur MySQL '.$mySqlErrno, $mysqlerror ."\n\n". $q );
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -24,11 +24,11 @@ if (isset($_REQUEST['login']) && isset($_REQUEST['pass'])){
|
||||
<table>
|
||||
<tbody><tr>
|
||||
<td class="data">Login</td>
|
||||
<td colspan="2" class="inserttext"><input id="login" name="login" size="20" value="mricois" type="text"></td>
|
||||
<td colspan="2" class="inserttext"><input id="login" name="login" size="20" value="" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="data">Pass</td>
|
||||
<td colspan="2" class="inserttext"><input id="pass" name="pass" size="20" value="bj10sx" type="password"></td>
|
||||
<td colspan="2" class="inserttext"><input id="pass" name="pass" size="20" value="" type="password"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="data"></td>
|
||||
|
Loading…
Reference in New Issue
Block a user