Example #1
0
<?php

require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
require_once "../includes/validation_function.php";
find_selected_product();
if (!$current_product) {
    redirect_to("manage_content.php");
}
if (isset($_POST['submit'])) {
    $id = $current_product["id"];
    $menu_name = mysql_prep($_POST["menu_name"]);
    $position = (int) $_POST["position"];
    $visible = (int) $_POST["visible"];
    $content = mysql_prep($_POST["content"]);
    $required_fields = array("menu_name", "position", "visible", "content");
    validate_presences($required_fields);
    $fields_with_max_lenghts = array("menu_name" => 30);
    validate_max_lengths($fields_with_max_lenghts);
    // $fields_with_max_lenghts=array( "content" => 50);
    //validate_max_lengths( $fields_with_max_lenghts);
    if (empty($errors)) {
        $query = " update products set ";
        $query .= "menu_name = '{$menu_name}', ";
        $query .= "position  = {$position}, ";
        $query .= "visible   = {$visible},  ";
        $query .= "content   = '{$content}' ";
        $query .= "where id  = {$id} ";
        $query .= "LIMIT 1";
        $result = mysqli_query($conn, $query);
Example #2
0
<?php

require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
$layout_context = "public";
include "../includes/layouts/header.php";
find_selected_product(true);
?>

<div id ="main">
 <div id ="navigation">
   <?php 
echo public_navigation($current_window, $current_product);
?>
  </div>
      <div id ="product">
         <?php 
if ($current_product) {
    ?>
       <h2> <?php 
    echo htmlentities($current_product["menu_name"]);
    ?>
 </h2>

            <?php 
    echo nl2br(htmlentities($current_product["content"]));
    ?>
 

         <?php