Public feed
#890257
<?phpclass main { var $content_file; var $template; function go($page) { switch ($page) { case "home": $this->content_file = "home.php"; break; case "register": $this->content_file = "register.php"; break; case "upload": $this->content_file = "upload.php"; break; } $template = "template.php"; $this->compile(); } function compile() { include "template.php"; }}class pages { function home() { }}class security { function std($a) { return addslashes(htmlspecialchars($a)); } function valid_image($img) { $valid = array("image/x-png", "image/jpeg", "image/png", "image/jpg", "image/gif"); }}class debug { function debug() { //MySQL Connection $connection = mysql_connect("localhost", "root", ""); mysql_select_db("dpix", $connection); } function list_users() { $result = mysql_query("SELECT * FROM dpix_users"); echo "<table><tr><th colspan=2>Users</th></tr>"; while ($arr = mysql_fetch_array($result)) { echo "<tr><td>$arr[id]</td><td>$arr[username]</td></tr>"; } echo "</table>"; }}class users { var $users = array(); function users() { } function load_user($id){ $this->users[$id] = new user(); $this->users[$id]->load($id); } function get($id, $info) { if ($this->user_check($id)) { return $this->users[$id]->get($info); } else { return false; } } function register_user($username) { $username = security::std($username); mysql_query(" INSERT INTO dpix_users ( username , password , joindate , lastactivedate ) VALUES ( '$username' , '".md5("password")."' , '".time()."' , '".time()."' ); "); } function user_check($id) { if (!array_key_exists($id, $this->users)) { $this->load_user($id); return true; } else { return false; } } }class user { private $updated; //bool flag private $getable; // Variables that can be set private $setable; // Variables that can be read private $id; private $username; private $joindate; private $lastactivedate; private $password; function user() { $this->setable = array("username", "password"); $this->getable = array("id", "username", "joindate", "lastactivedate"); } function load($id) { $query = mysql_query("SELECT * FROM dpix_users WHERE id=$id"); $result = mysql_fetch_object($query, get_class($this)); if ($result != false) { foreach(get_object_vars($result) as $var => $value) { $this->$var = $value; } } } function set($var, $value) { if (in_array($var, $this->setable)) { $this->$var = $value; $this->updated = true; } else { return false; } } function get($var) { return (in_array($var, $this->getable)) ? $this->$var : false; } function tostring() { echo "<pre>"; print_r($this); echo "</pre>"; } function save() { if(mysql_query("UPDATE dpix_users SET username = '$this->username' WHERE id=$this->id LIMIT 1")) { return true; } else { return false; } }}class images { var $images = array(); function load($id) { } function add() { $title = security::std($_POST['title']); $description = security::std($_POST['description']); echo basename($_FILES['file']['name']); $target_dir = "./dps/"; $uploaded = $target_dir . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploaded)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo $title . "<br />" . $description; //copy($_FILES["file"], "./dps/1/test.png"); /* mysql_query(" INSERT INTO dpix_dps ( filename , title , description ) VALUES ( '$filename' , '$description' ); "); */ }}class image { private $id; private $filename; private $description; function image($id) { $this->setable = array("title", "description"); $this->getable = array("id", "filename", "title", "description"); } function load($id) { $query = mysql_query("SELECT * FROM dpix_dps WHERE id=$id"); $result = mysql_fetch_object($query, get_class($this)); if ($result != false) { foreach(get_object_vars($result) as $var => $value) { $this->$var = $value; } } } function get($var) { return (in_array($var, $this->getable)) ? $this->$var : false; } }class imageeditor { var $id; var $data; function crop() { } }class ads { var $ads = array(); var $limit; function ads($group, $limit) { $this->ads = array("Woop", "Doop", "Moop", "Soop", "Boop"); $this->limit = $limit; } function display() { for ($i=0; $i<$this->limit; $i++) { echo $this->ads[$i]; } }}class email { function send($to, $subject, $content) { mail(security::std($to), security::std(subject), $content); }}?>