/ Published in: PHP
Intestazione per un qlsiasi file php che voglio fare (per non scordare i pezzetti)
Expand |
Embed | Plain Text
<?php //impedire accesso diretto } //vogliamo solo https //if($_SERVER['SERVER_PORT'] != 443) { // $url = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; // header("location: $url"); //} //errori //imposto la modalita $debug = false; $debug = (($_GET['debug'] == '1') || $_POST['debug'] == '1')? true: false; function error_page($user, $error, $error_spec){ global $filetxt; global $in; global $SRV; global $log_conn; global $service; global $remote_userid; global $session_number; $eol=PHP_EOL; $email_admin="g.delsignore@cineca.it, g.tufano@cineca.it,s.scalise@cineca.it"; if($error_spec==''){ $error_spec=ocierror($conn); } #echo "<hr>$session_number<br/>$service<br/>".$this->str."<hr>"; foreach ($error_spec as $key => $val) $spec.="\n $key : $val"; else $spec = $error_spec; //$debug_info_str = "<br>".$debug_info_str; //$debug_info_str = preg_replace("[\n]","<br>",$debug_info_str); //$debug_info_str = preg_replace("/array/i","<b>Array:</b>",$debug_info_str); //$debug_info_str = preg_replace("/([0-9]) =>/","<b> \\1 => </b>",$debug_info_str); $alltxt = "* Data: $today * Errore: $error * Session Number:$session_number IP richiesta: {$_SERVER['REMOTE_ADDR']} * URL richiesta: {$_SERVER['REQUEST_URI']} * Servizio: $service * Specifiche errore: $spec * Chiamata ajax: $ajax * var export (_SERVER): $debug *DEBUG INFO: ".$debug_info_str; $headers = "From: ERROR_".$service."@{$_SERVER['SERVER_NAME']}$eol"; // $headers .= "Content-type: text/html "; $headers .= "Content-type: text/plain; charset=utf-8$eol"; // $debug_info=nl2br(var_export( debug_backtrace(), TRUE ) ); $prod=""; if(preg_match("/\.agenziafarmaco\./", $_SERVER['HTTP_HOST'])){ if(preg_match("/too large/i",$spec)) { $edo=substr($spec,strpos($spec,"value too large for column")+28,strlen($spec)); $edo=substr($edo,0,strpos($edo,"(actual:")); $edo=substr($edo,strrpos($edo,".")+1); $body="<h2 style=\"color:red;\">Valore troppo grande per il campo: ".$edo."</h2>"; } $body.="<h3>Errore del sistema. Contattare il supporto tecnico.</h3>$debug_info"; $prod="_!PRODUZIONE!"; } else { // foreach($debug as $key => $val) { // foreach($val as $k => $v) { // $debug_info.=$k." ".$v."<br />"; // } // } $body="<h2>ERRORE DEVEL</h2><h3>$error</h3><br />$debug_info"; // print_r($debug[0]); // $debug_info=var_export($debug,true); } } // --------------- FINE FUNZIONI ---------------------- //
You need to login to post a comment.
