AdminLogs::create PHP Метод

create() публичный Метод

public create ( $text )
    public function create($text)
    {
        $searchText = Helper::searchfield($text);
        $sth = $this->db->prepare('INSERT INTO adminlog (added, txt, userid, search_text) VALUES (NOW(), ?, ?, ?)');
        $sth->bindParam(1, $text, PDO::PARAM_STR);
        $sth->bindValue(2, $this->user->getId(), PDO::PARAM_INT);
        $sth->bindParam(3, $searchText, PDO::PARAM_STR);
        $sth->execute();
    }

Usage Example

Пример #1
0
 public function delete($id)
 {
     if ($this->getClass() < self::CLASS_ADMIN) {
         throw new Exception('Du saknar rättigheter.', 401);
     }
     $user = $this->get($id);
     foreach (explode(", ", "iplog, bonuslog, bookmarks, snatch, reqvotes, blocks, bevaka, cheatlog, invites, readposts, peers") as $x) {
         $this->db->query("DELETE FROM " . $x . " WHERE userid = " . $id);
     }
     $this->db->query("DELETE FROM users WHERE id = " . $id);
     $this->db->query("DELETE FROM messages WHERE receiver = " . $id);
     $this->db->query("DELETE FROM friends WHERE friendid = " . $id . " OR userid = " . $id);
     $adminlogs = new AdminLogs($this->db, $this);
     $adminlogs->create("{{username}} raderade kontot [b]" . $user["username"] . "[/b] ifrån databasen");
 }
All Usage Examples Of AdminLogs::create