1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
<?
session_start();
$login=$_SESSION['login'];
?>
<html>
<head>
<title>Commande</title>
</head>
<body bgcolor="gold">
<?
$image=$HTTP_GET_VARS['prod'];
if (isset($HTTP_POST_VARS['qte']))
{
// D'abord, on se connecte à MySQL
mysql_connect("localhost", "root", "");
mysql_select_db("claire");
$qte = htmlentities($HTTP_POST_VARS['qte'], ENT_QUOTES); // On utilise htmlentities par mesure de sécurité
$req= "update produit set Stock = Stock - ".$qte." , Vendu = Vendu + ".$qte." where Ref = ".$image."";
echo '<br>'.$req ; // Ensuite on enregistre les donnees
$resultat=mysql_query($req);
echo $resultat;
mysql_close();
}
$qte = htmlentities($HTTP_POST_VARS['qte'], ENT_QUOTES);
print "Vous venez de commander ";
$fichiernom="client/".$login.".txt";
$client = fopen($fichiernom, "a+") ;
fseek($client, 0);
fputs($client, $qte);
include ($fichiernom);
fclose($client);
print "articles.";
?>
</body>
</hhtml> |