コード例 #1
0
<?php

session_start();
require_once __DIR__ . '/db-conf.php';
require_once __DIR__ . '/libs.php';
if (isAuthorized() !== true) {
    header('LOCATION: ./registration.php');
}
$link = connect();
$update = updateProducts($link);
//echo $update;
$items = getItems($link);
?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Products table</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <nav id="nav">
        <ul>
            <li><a href="logout.php"> Logout(<?php 
echo getName();
?>
)</a></li>
        </ul>

    </nav>
コード例 #2
0
require_once 'template/header.php';
require_once 'functions/productsFunctions.php';
require_once 'functions/categorysFunctions.php';
require_once 'functions/sessionFunctions.php';
verifyUser();
$categorys = retrieveCategorys($connection);
$productId = $_POST['productId'];
$selected = "";
$productData = searchProduct($connection, $productId);
$id = $_POST['id'];
$product = $_POST['product'];
$price = $_POST['price'];
$description = $_POST['description'];
$category = $_POST['category_id'];
if (updateProducts($connection, $id, $product, $price, $description, $category)) {
    $_SESSION['success'] = "Product was successfully updated!";
    header("Location: retrieve.php");
    die;
}
?>

	<div class="col-lg-3"></div>
	<div class="col-lg-6">
		<h1 align="center">Edit Product</h1>
		<hr />
		<form action="update.php" method="post" accept-charset="utf-8">
			<input type="hidden" name="id" value="<?php 
echo $productData['productId'];
?>
" />
コード例 #3
0
ファイル: index.php プロジェクト: Zain-Ali/Capture-Cart
                    } else {
                        echo getProducts();
                    }
                } else {
                    echo getProduct($pathParts[1]);
                }
                break;
                // Create product on database using POST and view it using GET Method
            // Create product on database using POST and view it using GET Method
            case 'POST':
                postProducts();
                break;
                // Delete requrested product from database using DELETE Method
            // Delete requrested product from database using DELETE Method
            case 'DELETE':
                if (empty($pathParts[1])) {
                    echo "you can delete everthing!!";
                } else {
                    deleteProducts($pathParts[1]);
                }
                break;
                // Allow the user to Edit/Update Products on Database
            // Allow the user to Edit/Update Products on Database
            case 'PATCH':
                if (isset($pathParts[1])) {
                    updateProducts($pathParts[1]);
                }
        }
        break;
        // End of Switch Statement
}