Вход Регистрация
Файл: vk/admin/gifts.php
Строк: 88
<?php          if(isset($_POST['newg']) && $_POST['newg'] == 1){             $db->mysql_qw("INSERT INTO gifts(price,img) VALUES(?,?);",$_POST['price'],$_POST['img']);         }     ?>     <b>Новый подарок:</b>&nbsp     <form method='post'>         <input type='hidden' name='newg' value='1'>         <input type='text' name='img' placeholder='Ссылка на изображение'>         <input type='text' name='price' placeholder='Цена'><br>         <input type='submit' class='btn btn-success' value='Создать'>     </form>     <?php          if($_GET['action'] == "delete" && isset($_GET['id'])){             $q $db->mysql_qw("SELECT * FROM gifts WHERE id = ?;",$_GET['id']);             if(mysql_num_rows($q)>0){                 if(isset($_POST['delete'])){                     $db->mysql_qw("DELETE FROM gifts WHERE id = ?;",$_GET['id']);                     echo "                         <div class='alert alert-success'>                             <b>Подарок успешно удален!</b>                         </div>                     ";                 }else{                     echo "                         <center>                             <b>Вы действительно хотите удалить подарок?</b>                             <form method='post'>                                 <input type='hidden' name='delete' value='1'>                                 <input type='submit' class='btn btn-info' value='Удалить'>                                 <input type='button' class='btn btn-danger' value='Отменить' onClick='window.location.href="?page=gifts&gpage=".$_GET['gpage']."";'>                             </form>                         </center>                     ";                 }             }else{                 echo "                     <div class='alert alert-error'>                         <b>Подарок с данным ID не найден!</b>                     </div>                 ";             }             exit();         }         if($_GET['action'] == "edit" && isset($_GET['id'])){             if(isset($_POST['img'])){                 foreach($_POST as $key=>$val){                     $string .= ",".$key."='".$val."'";                 }                 $string substr($string1);                 mysql_query("UPDATE gifts SET ".$string." WHERE id = ".$_GET['id'].";");                 echo "                         <div class='alert alert-success'>                             <b>Подарок отредактирован!</b>                         </div>                 ";             }             $q $db->mysql_qw("SELECT * FROM gifts WHERE id = ?;",$_GET['id']);             if(mysql_num_rows($q)>0){                 while($val mysql_fetch_assoc($q)){                     echo "                         <form method='post'>                         <table class='admint'>                             <tr>                                 <td>Цена</td>                                 <td><input type='text' name='price' value='".$val['price']."'></td>                             </tr>                             <tr>                                 <td>Фото</td>                                 <td><input type='text' name='img' value='".$val['img']."'><br>Старое изображение:<br><img src='".$val['img']."'></td>                             </tr>                                                 </table>                         <br>                         <input type='submit' class='btn btn-info' value='Сохранить'> <input type='button' class='btn btn-danger' value='Отменить' onClick='window.location.href="?page=gifts&gpage=".$_GET['gpage']."";'>                         </form>                     ";                 }             }else{                 echo "                     <div class='alert alert-error'>                         <b>Подарок с данным ID не найден!</b>                     </div>                 ";             }         }else{             $q $db->mysql_qw("SELECT * FROM gifts ORDER BY ID DESC;");             $on_page 10;             $pages ceil(mysql_num_rows($q) / $on_page);             if($pages == 0){                 echo "<center><h3>Не создано ни одного подарка</h3></center>";             }else{                 if(!isset($_GET['gpage'])){                     $page_now 1;                 }else{                     $page_now $_GET['gpage'];                 }                 echo "Выберите страницу: ";                 for($c=1;$c<=$pages;$c++){                     if($c == $page_now){                         echo "<b>".$c."</b>";                     }else{                         echo "<a href='#'>".$c."</a>";                     }                 }                 $sd $page_now $on_page $on_page;                 echo "                     <table class='admint'>                         <tr>                             <td>Фото</td>                             <td>Цена</td>                             <td></td>                         </tr>                 ";                 $q $db->mysql_qw("SELECT * FROM gifts ORDER BY ID DESC LIMIT ?,? ",$sd$on_page);                 while($val mysql_fetch_assoc($q)){                     echo "                         <tr>                             <td><img src='".$val['img']."'></td>                             <td>".$val['price']."</td>                             <td>                                 <a href='?page=gifts&gpage=".$page_now."&id=".$val['id']."&action=edit'><img src='http://cdn2.iconfinder.com/data/icons/diagona/icon/16/018.png' class='editt'></a>                                 <a href='?page=gifts&gpage=".$page_now."&id=".$val['id']."&action=delete'><img src='http://cdn2.iconfinder.com/data/icons/diagona/icon/16/101.png' class='deletet'></a>                             </td>                         </tr>                     ";                 }                 echo "</table>";             }         }     ?>
Онлайн: 1
Реклама