/** * Gibt Smiley-Liste in Datenbank zurück * @return array */ public function getDatabaseList() { $smileys = $this->dbcon->fetch($this->dbcon->select($this->table), true); $res = array(); foreach ($smileys as $smiley) { $smileyObj = new smiley($smiley->filename, false); $smileyObj->setSmileycode($smiley->smileycode); $smileyObj->setId($smiley->id); $res[$smiley->filename] = $smileyObj; } return $res; }
<?php require_once '../../../arg.php'; class smiley extends FreiChat { public function sanitize($input) { $output = htmlspecialchars($input); return $output; } public function delete_smiley($image_name) { $image_name = $this->sanitize($image_name); $query = "DELETE FROM frei_smileys WHERE image_name='{$image_name}'"; $this->db->query($query); echo $query; } } $sm = new smiley(); if (isset($_REQUEST['smiley'])) { if ($_REQUEST['smiley'] == 'delete') { $sm->delete_smiley($_GET['image_name']); } }