diff --git a/log.php b/log.php
new file mode 100644
index 0000000..91d0fba
--- /dev/null
+++ b/log.php
@@ -0,0 +1,155 @@
+ INFO, ALERT, ERROR
+/*function log_write($log, $level=INFO)
+{
+ global $table_prefix, $webmaster, $headers;
+ $user = ( !empty( $_SERVER["PHP_AUTH_USER"])?$_SERVER["PHP_AUTH_USER"]:'' );
+ $log_mail = str_replace ( "
", "\n", $log ) . "\n";
+ $log_mail .= ( !empty( $_SERVER["REQUEST_METHOD"])?'$_SERVER["REQUEST_METHOD"]' . $_SERVER["REQUEST_METHOD"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["QUERY_STRING"])?'$_SERVER["QUERY_STRING"]' . $_SERVER["QUERY_STRING"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["HTTP_ACCEPT_LANGUAGE"])?'$_SERVER["HTTP_ACCEPT_LANGUAGE"]' . $_SERVER["HTTP_ACCEPT_LANGUAGE"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["HTTP_USER_AGENT"])?'$_SERVER["HTTP_USER_AGENT"]' . $_SERVER["HTTP_USER_AGENT"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["REMOTE_ADDR"])?'$_SERVER["REMOTE_ADDR"]' . $_SERVER["REMOTE_ADDR"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["REMOTE_HOST"])?'$_SERVER["REMOTE_HOST"]' . $_SERVER["REMOTE_HOST"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["REMOTE_USER"])?'$_SERVER["REMOTE_USER"]' . $_SERVER["REMOTE_USER"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["REQUEST_URI"])?'$_SERVER["REQUEST_URI"]' . $_SERVER["REQUEST_URI"] . "\n":'' );
+ $log_mail .= "Utilisateur: $user \n";
+ $log_mail .= ( !empty( $_SERVER["ORIG_PATH_INFO"])?'$_SERVER["ORIG_PATH_INFO"]' . $_SERVER["ORIG_PATH_INFO"] . "\n":'' );
+ $log_mail .= ( !empty( $_SERVER["PATH_INFO"])?'$_SERVER["PATH_INFO"]' . $_SERVER["PATH_INFO"] . "\n":'' );
+ $db1 = new db();
+ $db1->open();
+ if( !empty( $db1->connect ) )
+ {
+ $query = 'INSERT INTO ' . $table_prefix . 'logs SET date=NOW(), auteur="' . $db1->protect( $user ) . '", log="' . $db1->protect($log) . '", niveau="' . $level . '"';
+ $db1->query( $query );
+ if ( !$db1->result )
+ {
+ $text = $db1->error() . "\n\n" . $log_mail;
+ mail( $webmaster, "Erreur écriture logs => " . __file__ . " ligne " . __line__, $text, $headers );
+ }
+ $db1->close();
+ }else
+ {
+ echo $db1->error();
+ mail( $webmaster, "Erreur écriture logs => " . __file__ . " ligne " . __line__ , $log_mail, $headers );
+ }
+ if ( $level == ALERT )
+ {
+ mail( $webmaster, "Alerte Site Web", $log_mail, $headers );
+ }elseif ( $level == ERROR )
+ {
+ mail( $webmaster, "Erreur Site Web", $log_mail, $headers );
+ }
+}*/
+
+// $db = true -> écrire les logs dans la base (défaut)
+// $die = true -> execute die()
+function log_error($log, $w_db=true, $die=false)
+{
+ global $webmaster, $headers, $accueil, $db;
+ if ( $w_db ) log_write($log, ERROR);
+ echo "$log
\n";
+ $log_err = 'erreur dans la requête
un rapport détaillé a été envoyé au webmaster';
+ if ( $die )
+ {
+ echo "\n";
+ die( $log_err );
+ }else
+ {
+ $_SESSION['error'] = $log_err;
+ //header( 'Location: ' . $accueil );
+ }
+}
+
+function affich_log( $nl, $np = 1, $level=INFO )
+{
+ global $table_prefix, $webmaster, $headers, $base_url , $path , $page;
+ if( !empty( $db->open() ) )
+ {
+ $level_s = array( "aucune" , "info" , "alerte" , "erreur" );
+ $query = 'SELECT * FROM ' . $table_prefix . 'logs';
+ if ( $level != 0 )
+ {
+ $query .= " WHERE niveau='" . $level . "'";
+ }
+ $db->query($query) OR log_error($db->error() . "
" . __file__ . " ligne " . __line__ );
+ $total_lignes = $db->result->num_rows();
+ if ($total_lignes != 0 )
+ {
+
+ $n_pages = round( $total_lignes / $nl ) +1;
+
+ if ( $np == 0 )
+ {
+ $np = 1;
+ }elseif ( $np > $n_pages )
+ {
+ $np = $n_pages;
+ }
+ echo '
';
+ if ( $np > 1 )
+ {
+ echo 'Page précédente | ';
+ }
+ echo "\n" . '\n | ";
+ if ( $np < $n_pages )
+ {
+ echo 'Page suivante | ';
+ }
+ echo "\n" . '\n |
";
+ $query = 'SELECT * FROM ' . $table_prefix . 'logs';
+ if ( $level != 0 )
+ {
+ $query .= " WHERE niveau='" . $level . "'";
+ }
+
+ $query .= ' ORDER BY date DESC LIMIT ' . ( ( ( $np - 1 ) * $nl ) ) . ',' . $nl;
+ $db->query( $query ) OR log_error( $db->error( ) . "
" . __file__ . " ligne " . __line__ );
+ echo "date | auteur | log | niveau |
\n";
+ while ( $db->connect->mysqli_fetch_array( $db->result ) )
+ {
+ $niveau = $donnees["niveau"];
+ echo "" . $donnees["date"] . " | " . $donnees["auteur"] . " | " . $donnees["log"] . " | " . $level_s[ $niveau ] . " |
\n";
+ }
+ echo "
\n";
+ }else
+ {
+ "aucune réponse";
+ }
+ }
+}
+?>
diff --git a/session_init.php b/session_init.php
index 7c88686..3aee0d1 100644
--- a/session_init.php
+++ b/session_init.php
@@ -2,4 +2,5 @@
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
+set_include_path ("include/")
?>