Procházet zdrojové kódy

Update to alter class

tags/rls1
kenn408k před 6 roky
rodič
revize
df789aa8d9
1 změnil soubory, kde provedl 2 přidání a 0 odebrání
  1. 2
    0
      classes/alter.class.php

+ 2
- 0
classes/alter.class.php Zobrazit soubor

13
     public static function addNews($author, $title, $content, $image, $type) {
13
     public static function addNews($author, $title, $content, $image, $type) {
14
         $db = new DBClass();
14
         $db = new DBClass();
15
         $time = new DateTime();
15
         $time = new DateTime();
16
+        // Sanitize number
16
         $type = filter_var(trim($type), FILTER_SANITIZE_NUMBER_INT);
17
         $type = filter_var(trim($type), FILTER_SANITIZE_NUMBER_INT);
17
         $sql = "INSERT INTO `news` (`id`, `author`, `time`, `title`, `type`, `content`, `img`) VALUES (NULL, '$author', '" . $time->getTimestamp() . "', '$title', '$type', '$content', '$image');";
18
         $sql = "INSERT INTO `news` (`id`, `author`, `time`, `title`, `type`, `content`, `img`) VALUES (NULL, '$author', '" . $time->getTimestamp() . "', '$title', '$type', '$content', '$image');";
18
         $db->query($sql);
19
         $db->query($sql);
22
 
23
 
23
     public static function editNews($id, $title, $content, $image, $type) {
24
     public static function editNews($id, $title, $content, $image, $type) {
24
         $db = new DBClass();
25
         $db = new DBClass();
26
+        // Sanitize number
25
         $type = filter_var(trim($type), FILTER_SANITIZE_NUMBER_INT);
27
         $type = filter_var(trim($type), FILTER_SANITIZE_NUMBER_INT);
26
         if ($image != false) {
28
         if ($image != false) {
27
             $sql = "UPDATE `news` SET `title` = '$title', `img` = '$image', `content` = '$content', `type` = '$type' WHERE `news`.`id` = $id;";
29
             $sql = "UPDATE `news` SET `title` = '$title', `img` = '$image', `content` = '$content', `type` = '$type' WHERE `news`.`id` = $id;";

Načítá se…
Zrušit
Uložit