76 lines
1.8 KiB
PHP
76 lines
1.8 KiB
PHP
<?php
|
|
function redirect($url) {
|
|
//If headers are sent... do javascript redirect... if javascript disabled, do html redirect.
|
|
echo '<script type="text/javascript">';
|
|
echo 'window.location.href="'.$url.'";';
|
|
echo '</script>';
|
|
echo '<noscript>';
|
|
echo '<meta http-equiv="refresh" content="10;url='.$url.'" />';
|
|
echo '</noscript>'; exit;
|
|
}
|
|
|
|
session_start();
|
|
# carico variabili da input
|
|
$resetta=$_GET[resetta];
|
|
$lastSel=$_GET[prodotto];
|
|
$fullSel=$_SESSION[fullSel];
|
|
|
|
# se richiesta resetta allora svuoto tutto
|
|
if($resetta=='true')
|
|
{
|
|
$lastSel="";
|
|
$fullSel[anguria]=0;
|
|
$fullSel[arancia]=0;
|
|
$fullSel[banana]=0;
|
|
$fullSel[ciliegie]=0;
|
|
$fullSel[fragola]=0;
|
|
$fullSel[kiwi]=0;
|
|
$fullSel[limone]=0;
|
|
$fullSel[mela]=0;
|
|
$_SESSION[fullSel]=$fullSel;
|
|
# reset
|
|
header("location:index.php");
|
|
exit;
|
|
}
|
|
# controllo: se c'è qualcosa di selezionato come comando allora lo aggiungo alla selezione full
|
|
if($lastSel!="")
|
|
{
|
|
# aggiungo ad esemento array una unità di prodotto
|
|
switch ($lastSel) {
|
|
case "banana":
|
|
$fullSel[banana]=$fullSel[banana]+1;
|
|
break;
|
|
case "mela":
|
|
$fullSel[mela]=$fullSel[mela]+1;
|
|
break;
|
|
case "fragola":
|
|
$fullSel[fragola]=$fullSel[fragola]+1;
|
|
break;
|
|
case "ciliegie":
|
|
$fullSel[ciliegie]=$fullSel[ciliegie]+1;
|
|
break;
|
|
case "arancia":
|
|
$fullSel[arancia]=$fullSel[arancia]+1;
|
|
break;
|
|
case "limone":
|
|
$fullSel[limone]=$fullSel[limone]+1;
|
|
break;
|
|
case "anguria":
|
|
$fullSel[anguria]=$fullSel[anguria]+1;
|
|
break;
|
|
case "kiwi":
|
|
$fullSel[kiwi]=$fullSel[kiwi]+1;
|
|
break;
|
|
}
|
|
$_SESSION[fullSel]=$fullSel;
|
|
# se ho letto valore faccio redirect a pagina "Pulita"...
|
|
#$url="index.php";
|
|
#redirect($url);
|
|
header("location:index.php", true, 302);
|
|
#header("Refresh: 0; URL=http://www.steamware.net/cassera/index.php");
|
|
#echo "<meta http-equiv='Refresh' content='0;URL=http://www.steamware.net/cassera/index.php'>";
|
|
exit;
|
|
}
|
|
|
|
?>
|