static function logIn($email, $password) { DBConnection::connect(); $match = DBConnection::select('SELECT id, pseudo FROM user WHERE email="' . DBConnection::getCleanVar($email) . '" AND password="******"'); if ($match) { $user = new User($match[0]->id, $match[0]->pseudo, false); $user->setToken(); return true; } else { return false; } }
static function update($id, $title, $content) { DBConnection::connect(); DBConnection::update('UPDATE post SET title = \'' . DBConnection::getCleanVar($title) . '\', content = \'' . DBConnection::getCleanVar($content) . '\' WHERE id = ' . DBConnection::getCleanVar($id)); return $id; }