db = new SQLiteDatabase("/var/www/www.moufette.com/htdocs/magnetic/words", 0666, $error); $this->processFile(); } public function processFile() { $query = "SELECT * FROM words ORDER BY id"; $res = $this->db->query($query); $this->numWords = 0; while ($row = $res->fetch()) { $this->words[$this->numWords][0] = trim($row['word']); $this->words[$this->numWords][1] = $row['y']; $this->words[$this->numWords][2] = $row['x']; $this->words[$this->numWords][3] = $row['z']; $this->numWords++; } if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') { if ($_REQUEST['f'] == "save") { echo $this->save($_REQUEST['id'], $_REQUEST['x'], $_REQUEST['y'], $_REQUEST['z']); } elseif ($_REQUEST['f'] == "repaint") { echo $this->repaint(); } } } public function printTiles() { $retHTML = ""; for ($i=0; $i<$this->numWords; $i++) { $tileWidth = 7 * strlen($this->words[$i][0]); $tileHeight = 13; $retHTML .= '