Send email error report

From , 5 Years ago, written in PHP, viewed 179 times.
URL https://pastebin.vip/view/15cf7646
  1. <?php  
  2.  
  3. // Our custom error handler  
  4. function nettuts_error_handler($number, $message, $file, $line, $vars){  
  5.     $email = "  
  6.        <p>An error ($number) occurred on line  
  7.        <strong>$line</strong> and in the <strong>file: $file.</strong>  
  8.        <p> $message </p>";  
  9.  
  10.     $email .= "<pre>" . print_r($vars, 1) . "</pre>";  
  11.  
  12.     $headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";  
  13.  
  14.     // Email the error to someone...  
  15.     error_log($email, 1, 'you@youremail.com', $headers);  
  16.  
  17.     // Make sure that you decide how to respond to errors (on the user's side)  
  18.     // Either echo an error message, or kill the entire project. Up to you...  
  19.     // The code below ensures that we only "die" if the error was more than  
  20.     // just a NOTICE.  
  21.     if ( ($number !== E_NOTICE) && ($number < 2048) ) {  
  22.         die("There was an error. Please try again later.");  
  23.     }  
  24. }  
  25.  
  26. // We should use our custom function to handle errors.  
  27. set_error_handler('nettuts_error_handler');  
  28.  
  29. // Trigger an error... (var doesn't exist)  
  30. echo $somevarthatdoesnotexist;

Reply to "Send email error report"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website