Guest User

Untitled

a guest
Sep 1st, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. <?php
  2.  
  3. ##########################
  4. # ->Error_report and query class
  5. # ->By Paulo Serra
  6. # ->V. 0.8 (its not finished)
  7. ##########################
  8.  
  9. class debuger{
  10.  
  11. private function sent_error($body, $qry, $file){
  12. require_once("Mail.php");
  13.  
  14. //insert here your mail information
  15. //you can use any other mail class
  16.  
  17. $from = "";
  18. $to = "";
  19. $subject = "Debugger: ".$file;
  20. $host = "";
  21. $username = "";
  22. $password = "";
  23.  
  24. $headers = array ('From' => $from,
  25. 'To' => $to,
  26. 'Subject' => $subject);
  27.  
  28. $smtp = Mail::factory('smtp',
  29. array ('host' => $host,
  30. 'auth' => true,
  31. 'username' => $username,
  32. 'password' => $password));
  33.  
  34. $mail = $smtp->send($to, $headers, $body);
  35.  
  36. if (PEAR::isError($mail)) {
  37. echo("<p>" . $mail->getMessage() . "</p>");
  38. }
  39. }
  40.  
  41.  
  42. protected function error_handling($message, $qry){
  43. try {
  44. throw new Exception($message);
  45. }catch(Exception $e){
  46. @$message = $e->getMessage();
  47. @$linha = $e->getLine();
  48. @$code = $e->getCode();
  49. @$file = $e->getFile();
  50. @$trace = $e->getTrace();
  51.  
  52. $body ='';
  53. if($qry != ''){
  54. $body .= "Query: ----> " . $qry . " -------->";
  55. }
  56. $body .= " ERRO: A MENSAGEM ----->". $message;
  57. $body .= " ERRO: O FICHEIRO ----->". $file . "(".$code.")";
  58. $body .= " ERRO: NA LINHA ----->". $linha;
  59. $body .= " ERRO: TRACING ----->". $trace;
  60.  
  61. $this->sent_error($body, $qry, $file);
  62.  
  63. }
  64. }
  65. }
  66.  
  67. ?>
Add Comment
Please, Sign In to add comment