Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ##########################
- # ->Error_report and query class
- # ->By Paulo Serra
- # ->V. 0.8 (its not finished)
- ##########################
- class debuger{
- private function sent_error($body, $qry, $file){
- require_once("Mail.php");
- //insert here your mail information
- //you can use any other mail class
- $from = "";
- $to = "";
- $subject = "Debugger: ".$file;
- $host = "";
- $username = "";
- $password = "";
- $headers = array ('From' => $from,
- 'To' => $to,
- 'Subject' => $subject);
- $smtp = Mail::factory('smtp',
- array ('host' => $host,
- 'auth' => true,
- 'username' => $username,
- 'password' => $password));
- $mail = $smtp->send($to, $headers, $body);
- if (PEAR::isError($mail)) {
- echo("<p>" . $mail->getMessage() . "</p>");
- }
- }
- protected function error_handling($message, $qry){
- try {
- throw new Exception($message);
- }catch(Exception $e){
- @$message = $e->getMessage();
- @$linha = $e->getLine();
- @$code = $e->getCode();
- @$file = $e->getFile();
- @$trace = $e->getTrace();
- $body ='';
- if($qry != ''){
- $body .= "Query: ----> " . $qry . " -------->";
- }
- $body .= " ERRO: A MENSAGEM ----->". $message;
- $body .= " ERRO: O FICHEIRO ----->". $file . "(".$code.")";
- $body .= " ERRO: NA LINHA ----->". $linha;
- $body .= " ERRO: TRACING ----->". $trace;
- $this->sent_error($body, $qry, $file);
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment