Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/06/2010, 13:08
Avatar de syntex
syntex
 
Fecha de Ingreso: noviembre-2002
Ubicación: Cataluña
Mensajes: 978
Antigüedad: 21 años, 5 meses
Puntos: 4
Respuesta: Problemas con clases de errores

Lo he hecho así y perfecto

Que mejorariais en un error de la bd?

Código PHP:
function errores() {
        
$this->ERR  "Url: "."http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."<br>";
        
$this->ERR .= "Pagina actual: ".$_SERVER['HTTP_REFERER']."<br>";
        
$this->ERR .= "Servidor: ".$_SERVER['SERVER_NAME']."<br>";
        
$this->ERR .= "Protocolo: ".$_SERVER['SERVER_SOFTWARE']."<br>";
        
$this->ERR .= "Ip: ".$_SERVER['REMOTE_ADDR']."<br>";
        
$this->ERR .= "<br>";
        
$bt=debug_backtrace(); 
        foreach(
$bt as $k=>$v)
           {
            
extract($v);
            
$file=substr($file,1+strrpos($file,"/"));
            if(
$file=="db.php")continue; // the db object
            
$trace.=str_repeat("&nbsp;",++$sp); //spaces(++$sp);
            
if ($function=="consultar"){
                
$this->ERR .= "<font color=\"#FF0000\"><strong>file=$file, line=$line, function=$function</strong></font><br>";
                }else{
                
$this->ERR .= "file=$file, line=$line, function=$function<br>";    
            }
        }     
        
$this->ERR .= '<br>';
        
$this->ERR .= "Fecha: ".date("Y-m-d")."<br>";    
        
$this->ERR .= "Hora: ".date("H:i:s")."<br>";    
        
$this->ERR .= '<br>';
        if (
$this->SELECT !=""){$this->ERR .= "SELECT: ".$this->SELECT."<br>";}
        elseif (
$this->NUMROWS !=""){$this->ERR .= "NUM_ROWS: ".$this->NUMROWS."<br>";}
        elseif (
$this->FREE_RESULT !=""){$this->ERR .= "FREE_RESULT: ".$this->FREE_RESULT."<br>";}
        elseif (
$this->MYSQL_CLOSE !=""){$this->ERR .= "MYSQL_CLOSE: ".$this->MYSQL_CLOSE."<br>";}
        
$this->ERR .= '<br>';
        
$this->ERR .= "Error ".mysql_errno($this->enlace)." : ".mysql_error($this->enlace);
            echo 
$this->ERR;
            exit;
    } 
__________________
------------------------------------------------
La paciencia es el rey de la ciencia
------------------------------------------------