<?php include "lib/lib.inc.php"; //підключення бібліотеки include "constants.php"; //костанти для підключення до сервева MySQL $title = $_GET['title']; $q = clearInt($_GET['quantity']); add2Basket($title, $q); header("Location: {$_SERVER['HTTP_REFERER']}"); exit;
<?php // подключение библиотек require "inc/lib.inc.php"; require "inc/db.inc.php"; $id = clearInt($_GET['id']); $quantity = 1; add2Basket($id, $quantity); header('Location: catalog.php'); exit;
function deleteGood($id) { global $db; try { $id = clearInt($id); $query = $db->prepare("DELETE FROM goods WHERE id = :id"); $query->execute(array(':id' => $id)); } catch (PDOException $e) { die($e->getMessage()); } }
<?php // подключение библиотек require "secure/session.inc.php"; require "../inc/lib.inc.php"; require "../inc/db.inc.php"; $title = clearStr($_POST['title']); $author = clearStr($_POST['author']); $pubyear = clearInt($_POST['pubyear']); $price = clearInt($_POST['price']); if (!addItemToCatalog($title, $author, $pubyear, $price)) { echo "Произошла ошибка при добавлении товара в каталог"; } else { header("Location: add2cat.php"); exit; }
move_uploaded_file($tmpImgPath, $imgs[$i]); } } } addToCatalog($title, $description, $price, serialize($imgs), $category); } elseif (isset($_POST['check'])) { $check = $_POST['check']; foreach ($check as $id) { deleteGood($id); } } elseif (isset($_POST['update'])) { $update_title = $_POST['update_title']; $update_price = $_POST['update_price']; updateGoods($update_title, $update_price); } header("Location:" . $_SERVER['HTTP_REFERER']); exit; } if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (isset($_GET['delOrder'])) { $delOrder = clearInt($_GET['delOrder']); delOrder($delOrder); } elseif (isset($_GET['status'])) { $statuses = $_GET['status']; updateStatus($statuses); } elseif (!empty($_GET['id'])) { deleteGood($_GET['id']); } header("Location:" . $_SERVER['HTTP_REFERER']); exit; }
<?php require "../classes/Lib.php"; require "../classes/DB.php"; $email = clearStr($_GET['email']); $user_id = clearInt($_GET['user_id']); $active_key = clearStr($_GET['active_key']); if (confirmReg($user_id, $active_key)) { $message = "Успешное подтверждение регистрации. Теперь вы можете авторизоваться."; header("Refresh:4; ../index.php"); } else { $message = "Ошибка подтверждения регистрации. Для повторного подтверждения регистрации нажмите на <a href='{$_SERVER['PHP_SELF']}?re=re'>ссылку</a>"; } if (clearStr($_GET['re']) === 're') { regUserMailer($email, $user_id, $active_key); } //подгружаем блок head и стили require "../inc/head.inc.php"; ?> <body> <div class="container-fluid"> <div class="row"> <div class="col-md-10"> <h1 class="bg-success"><?php echo $message; ?> </h1> <p class="bg-info">Сейчас вы будете перенаправлены на главную. Если не хотите ждать нажмите на <a href='../index.php'>ссылку</a></a> </p> </div> </div>