Exemplo n.º 1
0
<?php

if (!user_connected() || !verify_get_id($_GET['id'], $_SESSION['id'])) {
    include PATH_GLOBAL_VIEW . 'error_not_connected.php';
} else {
    if (!user_has_nabz($_SESSION['id']) > 0) {
        include PATH_GLOBAL_VIEW . 'error_no_nabz.php';
    } else {
        include PATH_MODEL . 'store.php';
        include PATH_LIB . 'form.php';
        //count the number of category
        $nbcat = number_category();
        //array where we will stock the product_id
        $tbx_index = array();
        //Repeat for each category
        for ($cat = 1; $cat <= $nbcat; $cat = $cat + 1) {
            $nbr = number_product_cat($cat);
            $infos_product = read_infos_product($cat);
            //Generate a buy form for each product, index is depending on product id
            for ($i = 0; $i < $nbr; $i = $i + 1) {
                $index = $infos_product['product_id'][$i];
                $form_buy[$index] = new Form('form_buy' . $index);
                $form_buy[$index]->method('POST');
                $form_buy[$index]->add('Submit', 'submit')->value("Ajouter au panier");
                $form_buy[$index]->bound($_POST);
                //construct a array with the product_id
                array_push($tbx_index, $index);
            }
        }
        //end of for loop in cat
        $error_buy = array();
Exemplo n.º 2
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">

<head>

	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

	<title>Nabzfood - Un lapin qui a de l'appétit</title>

	<meta http-equiv="Content-Language" content="fr" />

	<link rel="stylesheet" href="style/global.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="style/nabz.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="style/table_product.css" type="text/css" media="screen" />

</head>

<body>

	<h1>Nabzfood - Un lapin qui a de l'appétit</h1>

<div id="left">
<?php 
include 'global/menu.php';
if (user_connected() && user_has_nabz($_SESSION['id']) > 0) {
    include 'global/nabz_summary.php';
}
?>
</div>
	<div id="centre">