131 lines
2.9 KiB
PHP
Executable File
131 lines
2.9 KiB
PHP
Executable File
<?php
|
|
session_start();
|
|
$idcateg=$HTTP_POST_VARS["idcateg"];
|
|
$idfamille=$HTTP_POST_VARS["idfamille"];
|
|
$idprod=$HTTP_POST_VARS["idprod"];
|
|
$ajouter=$HTTP_POST_VARS["ajouter"];
|
|
$prix=$HTTP_POST_VARS["prix"];
|
|
$qteprod=$HTTP_POST_VARS["qteprod"];
|
|
$marge=$HTTP_POST_VARS["marge"];
|
|
print "idprod = $idprod";
|
|
print "idfamille = $idfamille";
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
</head>
|
|
|
|
<body>
|
|
<div align="center">
|
|
<table border=1>
|
|
<tr>
|
|
<td colspan=2 align="center">
|
|
<h1>Site Marchand Airtria</h1>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan=2 align="center">
|
|
<br>
|
|
<br>
|
|
<h1>Gestion des produits</h1>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<?php
|
|
require("../connexion.php");
|
|
$conn = mysql_connect($host, $user, $password);
|
|
mysql_select_db($bdd) or die("Impossible d'ouvrir la base de donnee $bdd");
|
|
if ($ajouter)
|
|
{
|
|
$requete1 = "insert into prix (prix,qteprod,marge,idprod) values ('$prix','$qteprod','$marge','$idprod')";
|
|
$result1=mysql_query($requete1) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
}
|
|
|
|
|
|
|
|
$requete = "select idprix,prix,marge,qteprod,coef from prix where idprod='$idprod'";
|
|
$result=mysql_query($requete) or die ("Erreur SQL :$requete<br>".mysql_error()."...");
|
|
$i=0;
|
|
while ($ligne = mysql_fetch_row($result))
|
|
{
|
|
$idprix[$i]=$ligne[0];
|
|
$testprix[$i]=$ligne[1];
|
|
$marge[$i]=$ligne[2];
|
|
$qteprod[$i]=$ligne[3];
|
|
|
|
if ($marge[$i])
|
|
{
|
|
$prix= "http://crossover.codeweavers.com/vendor_price_query.php?user=tallagrand@airtria.fr;sku=".$testprix[$i];
|
|
$hwnd=fopen($prix,"r");
|
|
$prix[$i] = fread($hwnd, 100);
|
|
fclose($hwnd);
|
|
}
|
|
$i++;
|
|
}
|
|
$i--;
|
|
?>
|
|
<table>
|
|
|
|
<?php
|
|
for ($j=0;$j<=$i;$j++)
|
|
{
|
|
?>
|
|
<tr>
|
|
<td>
|
|
Prix num <?php print $j?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
Prix : <?php print $testprix[$j]?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
Qte de produits <?php print $qteprod[$j]?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
Marge : <?php print $marge[$j]?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
<form name="ajout" action="ajoutprix.php" method="post">
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
Prix : <input type="text" name="prix"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
Qte de produit : <input type="text" name="qteprod"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
marge : <input type="text" name="marge"/>
|
|
</td>
|
|
</tr>
|
|
<td>
|
|
<input type="hidden" name="idprod" value="<?php print $idprod?>"/>
|
|
<input type="hidden" name="idcateg" value="<?php print $idcateg?>"/>
|
|
<input type="hidden" name="idfamille" value="<?php print $idfamille?>"/>
|
|
<input type="hidden" name="ajouter" value="ok"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<input type="submit" value="ok""/>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
<a href="detprod.php?loguer=oui&idprod=<?php print $idprod?>&idfamille=<?php print $idfamille?>&idcateg=<?php print $idcateg?>">Retour</a>
|
|
</div>
|
|
</body>
|
|
</html>
|