if (!($id = validClass::validNumber($_POST['id']))) { unset($id); } } if (isset($_POST['name'])) { if (!($name = validClass::sanitiseString($_POST['name']))) { unset($name); } } if (isset($_POST['position'])) { if (!($position = validClass::sanitiseString($_POST['position']))) { unset($position); } } if (isset($_POST['weight'])) { if (!($weight = validClass::validNumber($_POST['weight']))) { unset($weight); } } if (isset($_POST['description'])) { if (!($description = $editorClass->replaceToInsert($_POST['description']))) { unset($description); } } if ($id > 0) { $imageClass = new imageClass(); // Обновляем $qwery = "UPDATE " . $name_dir . "\n SET name = '" . $name . "',\n position = '" . $position . "',\n weight = '" . $weight . "',\n description = '" . $description . "'\n WHERE id='" . $id . "'"; $db->query($qwery); echo "<p style='color:green;'>Данные успешно обновлены</p>"; if (($tempFile = $_FILES['url_image']['tmp_name']) != "") {
<?php $root = $_SERVER['DOCUMENT_ROOT']; require_once $root . "/admin/blocks/include.php"; // Подключение отправки формы echo '<script type="text/javascript" src="js/jquery.form.js"></script>'; if (isset($_POST['id'])) { if (!($id = validClass::validNumber($_POST['id']))) { unset($id); } } if (isset($_POST['action'])) { if (!($action = validClass::sanitiseString($_POST['action']))) { unset($action); } } if (isset($_POST['type'])) { if (!($type = validClass::sanitiseString($_POST['type']))) { unset($type); } } // Инициализируем подключение $db = db::getInstance(); // Если пришла команда удалить файл $item = null; if ($action == 'edit' && $id > 0) { // Достаем $qwery = "SELECT * \n FROM backstage \n WHERE id='" . $id . "'"; $db->query($qwery); $item = $db->getRow(); }
$root = $_SERVER['DOCUMENT_ROOT']; require_once $root . "/admin/blocks/include.php"; $db = db::getInstance(); $editorClass = new editorClass(); if (isset($_POST['id'])) { if (!($id = validClass::validNumber($_POST['id']))) { unset($id); } } if (isset($_POST['portfolio_cat'])) { if (!($portfolio_cat = validClass::validNumber($_POST['portfolio_cat']))) { unset($portfolio_cat); } } if (isset($_POST['name'])) { if (!($client = validClass::validNumber($_POST['name']))) { unset($client); } } if (isset($_POST['description'])) { if (!($description = $editorClass->replaceToInsert($_POST['description']))) { unset($description); } } if ($id > 0) { $imageClass = new imageClass(); $select_name_client = 'SELECT name FROM partner_logo WHERE id=' . $client; $db->query($select_name_client); if ($db->getCount() > 0) { $client_text = $db->getValue(); }
<?php $root = $_SERVER['DOCUMENT_ROOT']; require_once $root . "/admin/blocks/include.php"; $db = db::getInstance(); $editorClass = new editorClass(); if (isset($_POST['portfolio_cat'])) { if (!($portfolio_cat = validClass::validNumber($_POST['portfolio_cat']))) { unset($portfolio_cat); } } if (isset($_POST['client'])) { if (!($client = validClass::sanitiseString($_POST['client']))) { unset($client); } } if (isset($_POST['description'])) { if (!($description = $editorClass->replaceToInsert($_POST['description']))) { unset($description); } } $imageClass = new imageClass(); $qwery = "INSERT INTO portfolio \n (id_portfolio_cat, client, description,create_time) \n VALUES \n ('" . $portfolio_cat . "', '" . $client . "', '" . $description . "', '" . date('YmdHis') . "')"; $db->query($qwery); $id = $db->last(); echo "<p style='color:green;'>Данные успешно сохранены</p>"; if (($tempFile = $_FILES['url_image']['tmp_name']) != "") { $targetPath = $root . '/img/portfolio/'; if (!($image_info = $imageClass->getImageInfo($tempFile))) { echo "<p style='color:red;'>Обработка файла изображения невозможна</p>"; exit;