Algoritmo Fibonacci Lavagna Master Slave
Aug 20
// genera_log.class.php
 
 
 
/* Script creato da Gianluca Greco email: grechk@aliceposta.it
 
DigiTech
 
p.zza Cortilio, 10 - Sarmato provincia di Piacenza
 
www.digitechonline.it
 
*/
 
class genera_log
 
{
 
# Funzioni per generare un file di log
 
# utile per tenere traccia di eventi
 
# (per esempio l'accesso all'area amministrativa del sito)
 
#
 
# Esempio di utilizzo della classe:
 
# $log = new genera_log('directory dei log','file di log');
 
# $log->intestazione_log();
 
# $log->scrivi_riga('stringa da scrivere esempio nome utente, ora di accesso, ecc...');
 
# $log->scrivi_riga('seconda riga da scrivere');
 
# ...
 
# $log->scrivi_riga_xxx();
 
# $log->chiudi_file_log();
 
var $handler;
 
var $nome_file;
 
var $ora;
 
var $data;
 
function genera_log($dir,$nome_file)
 
{
 
$this->ora = date("H-i-s");
 
$this->data = date("d-m-Y");
 
$this->apri_file_scrittura($dir,$nome_file);
 
}
 
function apri_file_scrittura($dir,$nome_file)
 
{
 
if (($dir != "")&&($nome_file != ""))
 
{
 
$nome_file = $nome_file."_".$this->data."_".$this->ora.".log";
 
$this->handler = @fopen($dir.$nome_file,"w");
 
$this->nome_file = $nome_file;
 
}
 
}
 
function get_nome_file_log()
 
{
 
return $this->nome_file;
 
}
 
function intestazione_log()
 
{
 
$out="# log automatico
 
# creato da Gianluca Greco
 
# Digitech - www.digitechonline.it
 
# generato il ".$this->data."
 
#
 
# Nome file : ".$this->nome_file."
 
#
 
# --------------------------------------------------------------------nn";
 
$this->scrivi_riga($out);
 
}
 
function scrivi_riga($stringa)
 
{
 
if ($this->handler != FALSE)
 
{
 
if (fwrite($this->handler,$stringa."n"))
 
{
 
return 1;
 
}
 
return 0;
 
}
 
return 0;
 
}
 
function scrivi_riga_xxx()
 
{
 
$this->scrivi_riga("*********************************************************n");
 
}
 
function chiudi_file_log()
 
{
 
fclose($this->handler);
 
}
 
}
 
?>

(Nessun voto)
Loading ... Loading ...

Inserisci il tuo Commento:

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a