diff --git a/Makefile b/Makefile index ec3db14..b57960b 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,3 @@ docker-run: data/ FORCE: cp -r src/data ./ chmod 777 data - -docker-run-dev: data/ src/ - docker run -v $(current_dir)src/:/var/www/html/ -v $(current_dir)data/:/var/www/html/data/ -p 8080:80 snuffler/snuffler-web:dev \ No newline at end of file diff --git a/src/inc/database.php b/src/inc/database.php index da03ecb..2860e86 100755 --- a/src/inc/database.php +++ b/src/inc/database.php @@ -102,7 +102,7 @@ class DataBase extends SQLite3 { function addPersona($userid, $handle, $name, $about=NULL, $colour=NULL) { $id = hexdec(uniqid()); - $sql = "INSERT INTO personas (id, userid, handle, name, about, colour) VALUES ('$id', '$userid', '$handle', '$name', '$about', '$colour');"; + $sql = "INSERT INTO personas (id, userid, handle, name, colour) VALUES ('$id', '$userid', '$handle', '$about', '$colour');"; $ret = $this->exec($sql); if(!$ret) { die($this->lastErrorMsg()); @@ -125,9 +125,6 @@ class DataBase extends SQLite3 { return false; } $dbhash = $ret[0]; - if(!$dbhash) { - return false; - } return password_verify($password, $dbhash); } @@ -195,19 +192,5 @@ class DataBase extends SQLite3 { } return $array; } - - function getPersonas($userid=NULL) { - if(!$userid) { - $userid = $this->getAuthedUserId(); - } - $sql = "SELECT * FROM personas AS persona WHERE userid='$userid' ORDER BY name;"; - - $ret = $this->query($sql); - $array = array(); - while ($row = $ret->fetchArray(SQLITE3_ASSOC)) { - array_push($array, $row); - } - return $array; - } } ?> diff --git a/src/index.php b/src/index.php index 572542d..801fb0c 100755 --- a/src/index.php +++ b/src/index.php @@ -55,16 +55,12 @@ if(!$database) { } else { ?> LOG OUT -
+
- + +
@@ -84,8 +80,8 @@ $posts = array_reverse($database->getPosts()); foreach($posts as $post) { echo '
'; echo ''; echo '

' . $post["post.text"] . '

'; diff --git a/src/post.php b/src/post.php deleted file mode 100644 index e69d9c0..0000000 --- a/src/post.php +++ /dev/null @@ -1,14 +0,0 @@ -getAuthedUserId(); -$persid = $_POST['persona']; // TODO: CHECK OWNERSHIP! (db schema?) -if($userid) { - $db->addPost($_POST['text'], $userid, $persid); -} -header("Location: /"); -?>