Error Class
Posted: Fri Aug 03, 2012 9:57 pm
<?php class error { public $body; public $id; public $dateSent = date('D, d M Y H:i:s O (T)'); public $page; public $user; public $headers; public static function __construct($page = $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_POST'] . $_SERVER['URI'], $user = $_SERVER['username'], $headers = $_SERVER){ if(isset($page)){ $this->page = $page; } if(isset($user)){ $this->user = $user; } if(isset($headers)){ $this->headers = $headers; } } public static function send($recipient) { } public static errorBody($body) { $this->body = $body; } public static db(){ $dbuser = 'root'; $dbpass = 'PPZXZkKazTG8e4qf'; $dbh = new PDO('mysql:host=localhost;dbname=zuploadr',$dbuser,$dbpass); $sth = $dbh->prepare('INSERT INTO `errors` (`errorId`, `body`, `page`,`user`,`headers`,`dateSent`) VALUES (?,?,?,?,?,?)'); $sth->bindParam(1, $this->id); $sth->bindParam(2, $this->body); $sth->bindParam(3, $this->page); $sth->bindParam(4, $this->user); $sth->bindParam(5, $this->headers); $sth->bindParam(6, $this->dateSent); $sth->execute(); } public static function generateID($prefix = ''){ $this->id = uniqid($prefix); } public static function returnAddress($address) { header('Location: ' . $address . '?errorId=' . $this->id); } } ?>Anything I'm missing?