entete.php
<div id="entete">
<table width="100%">
<tr>
<td width="14%" height="89" align="left">
<div id="logo"><img src="images/logo.png" width="215"
height="90"></div>
</td>
<td width="51%" align="center">
<div id="pub"><img src="images/pub1.jpg" width="529">
<height="87"></div>
</td>
<td width="35%" align="right" valign="bottom">
<div id="authentification">
<div>
<?php if(isset($_SESSION['ROLE_USER'])){ ?>
Authentifizierung mit Login : <?php echo($_SESSION['LOGIN']);?>
<?php }?>
</div>
<div>
<form method="post" action="authentifier.php">
Login : <input type="text" name="login" size="12" />
Pass:<input type="password" name="pass" size="12"/>
<input type="submit" value="OK"/>
</form>
</div>
</div>
</td>
</tr>
</table>
</div>
<div id="menu">
<table width="100%">
<tr>
<td width="24%" valign="top">
<form method="post" action="index.php" id="form2">
<input type="text" name="motCle"/>
<input type="submit" value="Suchen"/>
</form>
</td>
<td width="8%"><a href="index.php">Home</a></td>
<!--<td width="10%"><a href="index.php?promo=1">Promotions</a></td>-->
<td width="8%"><a href="index.php">Selection</a></td>
<td width="7%"><a href="index.php?panier=1">Krob</a></td>
<td width="15%"><a href="index.php">Abschicken</a></td>
<?php if(isset($_SESSION['ROLE_USER'])){ ?>
<td width="15%"><a href="GestionCategories.php">Management-Kategorien</a></td>
<td width="17%"><a href="GestionProduits.php">Management-Produkten</a></td>
<?php } ?>
<td width="1%"> </td>
</tr>
</table>
</div>
GestionCategories.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Management-Kategorien</title>
<link rel="stylesheet" type="text/css" href="style1.css" />
<script language="javascript">
function confirmation(idCat){
var rep=confirm("Sind sie sicher diese Kategorie zu löschen ?");
if(rep==true){
document.location="supprimerCategorie.php?idCat="+idCat
}
}
</script>
</head>
<body>
<?php require_once("entete.php")?>
<div id="formCategories" align="center">
<form method="post" action="addCategogie.php">
<table>
<tr>
<td>Name Kategorie:</td>
<td><input type="text" name="nomCat" /></td>
</tr>
<tr>
<td>Beschreibung:</td>
<td><textarea name="description" rows="3" cols="50"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="hinfügen" /></td>
</tr>
</table>
</form>
</div>
<div id="listeCategories" align="center">
<table border="1">
<tr>
<th>CODE CAT</th><th>NAME CAT</th><th>Beschreibung</th>
</tr>
<?php while($cat=mysql_fetch_assoc($rsCat)){?>
<tr>
<td><?php echo($cat['CODE_CAT'])?></td>
<td><?php echo($cat['NOM_CAT'])?></td>
<td><?php echo($cat['DESCRIPTION'])?></td>
<td>
<a href="javascript:confirmation(<?php echo($cat['CODE_CAT'])?>)">
Löschen
</a>
</td>
</tr>
<?php } ?>
</table>
</div>
</body>
</html>
GestionProduits.php
<?php require_once("connection.php")?>
<?php
session_start();
$req="select * from CATEGORIES";
$rsCat=mysql_query($req) or die(mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Management-categories</title>
<link rel="stylesheet" type="text/css" href="style1.css" />
</head>
<body>
<?php require_once("entete.php")?>
<div id="formProduits" align="center">
<form method="post" action="addProduit.php"
enctype="multipart/form-data">
<table>
<tr>
<td>Referenz:</td>
<td><input type="text" name="refProduit" /></td>
</tr>
<tr>
<td>Beschreibung:</td>
<td><input type="text" name="designation" /></td>
</tr>
<tr>
<td>Kategorie:</td>
<td>
<select name="idCat">
<?php while($cat=mysql_fetch_assoc($rsCat)){?>
<option value="<?php echo($cat['CODE_CAT'])?>">
<?php echo($cat['NOM_CAT'])?>
</option>
</option>
<?php }?>
</select>
</td>
</tr>
<tr>
<!--<td>Quantite:</td><td><input type="text" name="quantite" /></td>-->
</tr>
<tr>
<!--<td>Prix:</td><td><input type="text" name="prix" /></td>-->
</tr>
<tr>
<td>Bild:</td><td><input type="file" name="photo" /></td>
</tr>
<tr>
<!--<td>Disponible:</td><td><input type="checkbox" name="disponible" checked="checked" /></td>-->
</tr>
<tr>
<!--<td>En Promotion:</td><td><input type="checkbox" name="promotion" /></td>-->
</tr>
<tr>
<!--<td>Wählen:</td><td><input type="checkbox" name="selectionne"
checked="checked"/></td>-->
</tr>
<tr>
<td><input type="submit" value="Hinfügen" /></td>
</tr>
</table>
</form>
</div>
</body>
</html>
index.php
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kantteile</title>
<link rel="stylesheet" type="text/css" href="style1.css" />
</head>
<body>
<?php require_once("entete.php")?>
<table width="100%">
<tr>
<td width="2%" valign="top">
<div id="categories">
<?php require_once("categories.php")?>
</div>
</td>
<td width="78%">
<div id="contenu" align="left">
<div id="contenu" align="left">
<?php
if(isset($_GET['panier']))
require_once("panier.php");
else
require_once("produits.php")
?>
</div>
</td>
</tr>
</table>
</body>
</html>
panier.php
<?php
if(!(isset($_SESSION['panier']))){
$panier=array();
}
else{
$panier=$_SESSION['panier'];
}
?>
<table border="1">
<tr>
<th>Kantteile Type</th><th>Beschreibung</th><th>Menge</th>
<!--<th>Prix</th>-->
</tr>
<?php
$total=0;
for($i=0;$i<count($panier);$i++){
$total=$total/*+ $panier[$i]['quantite']* $panier[$i]['prix']*/;
?>
<tr>
<td><?php echo($panier[$i]['refProduit']) ?></td>
<td><?php echo($panier[$i]['designation']) ?></td>
<td><?php echo($panier[$i]['quantite']) ?></td>
<!--<td><?php echo($panier[$i]['prix']) ?></td>-->
<td><a href="supprimerdupanier.php?index=<?php echo($i)?>">Löschen</a></td>
</tr>
<?php } ?>
<tr>
<!--<td colspan="3">Total:</td><td><?php echo($total)?></td>-->
</tr>
</table>
<input type="button" value="Abschicken" onclick="document.location='commander.php'" />
produits.php
<?php require_once("connection.php")?>
<?php
if (isset($_POST['motCle'])){
$motCle=$_POST['motCle'];
$req="select * from PRODUITS where DESIGNATION LIKE
'%$motCle%'";
}
elseif (isset($_GET['idCat'])){
$idCat=$_GET['idCat'];
$idCat=$_GET['idCat'];
$req="select * from PRODUITS where CODE_CAT=$idCat";
}
elseif (isset($_GET['promo'])){
$req="select * from PRODUITS where PROMOTION=1";
}
else{
$req="select * from PRODUITS where SELECTIONNE=1";
}
$rsProd=mysql_query($req) or die (mysql_error());
?>
<div id="produits">
<?php while($prod=mysql_fetch_assoc($rsProd)){?>
<div id="produit">
<table>
<tr>
<td>Referenz:</td><td><?php echo $prod['REF_PRODUIT']?></td>
<td rowspan="1"><img src="images/<?php echo
$prod['PHOTO']?>"></td>
</tr>
</tr>
<tr><td width="0px">Beschreibung:</td><td width="100px"><?php echo
$prod['DESIGNATION']?></td></tr>
<!--<tr><td width="80px">Preis:</td><td><?php echo $prod['PRIX']?></td></tr>-->
<!--<tr><td width="80px">Menge:</td><td><?php echo $prod['QUANTITE']?></td>-->
</tr>
<tr>
<td colspan="3" align="right" margin-right="">
<div id="formPanier">
<form method="post" action="addCaddie.php" id="form2">
<table align="left"><th>
<tr>
<td><a>A=</a><input type="text" name="a" size="4" value="" /></td>
<td><a>B=</a><input type="text" name="a" size="4" value="" /></td>
</tr>
<tr>
<td><a>C=</a><input type="text" name="a" size="4" value="" /></td>
<td><a>D=</a><input type="text" name="a" size="4" value="" /></td>
</tr>
<tr>
<td><a>E=</a><input type="text" name="a" size="4" value="" /></td>
<td><a>F=</a><input type="text" name="a" size="4" value="" /></td>
</tr>
<tr>
<td><a>G=</a><input type="text" name="a" size="4" value="" /></td>
<td><a>H=</a><input type="text" name="a" size="4" value="" /></td>
</tr></th>
</table>
<input type="text" name="quantite" size="8" value="1" />
<input type="hidden" name="refProduit" value="<?php echo
$prod['REF_PRODUIT']?>" />
<input type="hidden" name="designation" value="<?php echo
$prod['DESIGNATION']?>" />
<input type="hidden" name="prix" value="<?php echo $prod['PRIX']?>" />
<input type="image" src="images/panier50.jpg" value="submit" />
</form>
</div>
</td>
</tr>
</table>
</div>
<?php }
mysql_free_result($rsProd);
?>
</div>
addCaddie.php
<?php
session_start();
if(!(isset($_SESSION['panier']))){
$panier=array();
}
else{
$panier=$_SESSION['panier'];
}
$index=count($panier);
$index=count($panier);
$panier[$index]['refProduit']=$_POST['refProduit'];
//$panier[$index]['prix']=$refProduit;
$panier[$index]['quantite']=$_POST['quantite'];
$panier[$index]['prix']=$_POST['prix'];
$panier[$index]['designation']=$_POST['designation'];
$_SESSION['panier']=$panier;
header("location:index.php?panier=1");
?>
addCategorie.php
<?php require_once("connection.php")?>
<?php
$nc=$_POST["nomCat"]; $d=$_POST["description"];
$req="insert into CATEGORIES (NOM_CAT,DESCRIPTION) values
('$nc','$d')";
mysql_query($req) or die(mysql_error());
mysql_query($req) or die(mysql_error());
header("location:GestionCategories.php")
?>
addProduit.php
<?php require_once("connection.php");?>
<?php
$ref=$_POST["refProduit"]; $des=$_POST["designation"];
$idCat=$_POST["idCat"]; $prix=$_POST["prix"]; $quantite=$_POST["quantite"];
$nomPhoto=$_FILES['photo']['name'];
$fichierTemporaire=$_FILES['photo']['tmp_name'];
move_uploaded_file($fichierTemporaire,"./images/$nomPhoto");
if(isset($_POST['promotion'])) $promo=1; else $promo=0;
if(isset($_POST['selectionne'])) $sel=1; else $sel=0;
if(isset($_POST['disponible'])) $dispo=1; else $dispo=0;
$req="(insert into PRODUITS(REF_PRODUIT,DESIGNATION,QUANTITE,PRIX,PHOTO,
DISPONIBLE,PROMOTION,SELECTIONNE,CODE_CAT)
values
('$ref','$des','$nomPhoto',$dispo,$promo,$sel)";
mysql_query($req) or die(mysql_error());
?>
<html> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<?php require_once("entete.php")?>
<h3> Daten wurden erfolgreich registrieren</h3>
<table border="1">
<tr> <td>Kantteile Type</td><td><?=$ref?> </td> </tr>
<tr> <td>Beschreibung :</td><td><?=$des?> </td></tr>
<tr> <td>Bild :</td><td><img src="images/<?=$nomPhoto?>" width="100"
height="50"/></td></tr>
<tr> <td>Prix :</td><td><?=$prix?> </td> </tr>
<tr> <td>Quantite :</td><td><?=$quantite?> </td> </tr>
<tr> <td>Code Kategorie :</td><td><?=$idCat?> </td> </tr>
<tr> <td>Disponible :</td><td><?=$dispo?> </td> </tr>
<tr> <td>Promotion :</td><td><?=$promo?> </td> </tr>
<tr> <td>Wählen :</td><td><?=$sel?> </td> </tr>
</table>
<a href="index.php">Home</a>
</body></html>
<?php
mysql_close($conn);
?>
authentifier.php
<?php require_once("connection.php")?>
<?php
session_start();
$_SESSION=array();
$l=$_POST['login'];
$p=$_POST['pass'];
$pc=md5($p);
$req="select * from USERS where LOGIN='$l' and PASS='$pc'";
$rs=mysql_query($req)or die(mysql_error());
$rs=mysql_query($req)or die(mysql_error());
if($u=mysql_fetch_assoc($rs)){
$_SESSION['ROLE_USER']=$u['NIVEAU'];
$_SESSION['LOGIN']=$l;
header("location:index.php");
}
else{
header("location:index.php");
}
?>
categorie.php
<?php require_once("connection.php")?>
<?php
$req="select * from CATEGORIES";
$rs=mysql_query($req) or die(mysql_error());
?>
<table>
<?php while($cat=mysql_fetch_assoc($rs)){ ?>
<tr>
<td>
<a href="index.php?idCat=<?php echo($cat['CODE_CAT'])?>">
<?php echo($cat['NOM_CAT'])?>
</a>
</td>
</tr>
<?php } ?>
</table>
<?php
mysql_free_result($rs);
?>
supprimerCategorie.php
<?php require_once("connection.php")?>
<?php
$idc=$_GET["idCat"];
$req="delete from CATEGORIES where CODE_CAT=$idc";
mysql_query($req) or die(mysql_error());
header("location:GestionCategories.php");
header("location:GestionCategories.php");
?>
supprimerdupanier.php
<?php
session_start();
$panier=$_SESSION['panier'];
$index=$_GET['index'];
$index=$_GET['index'];
unset($panier[$index]);
$_SESSION['panier']=$panier;
header("location:index.php?panier=1");
?>
connection.php
<?php
$conn=mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db("DWM_ECOM")or die(mysql_error());
?>
styles1.css
body{
border-radius:10px 10px 10px 10px;
border:1px dotted #000066;
font-family:Georgia, "Times New Roman", Times,
serif;
font-size:12px;
}
#logo,#pub,#authentification{
padding:5px;
height:90px;
border:1px dotted #000066;
}
#menu{
border:1px dotted #000066;
}
#produit{
border:1px dotted #000066;
border-radius:10px 10px 10px 10px;
float:left;
margin:10px;
padding:10px;
min-height:140px;
width:60%;
margin-left:20%;
}
#categories{
border:1px dotted #000066;
border-radius:10px 10px 10px 10px;
min-height:400px;
padding:10px;
width:200px;
}
#contenu{
.border:1px dotted #000066;
.border-radius:10px 10px 10px 10px;
min-height:400px;
padding:10px;
}
a{
text-decoration:none;
color:#990000;
padding:4px;
}
a:hover{
border:1px solid #990000;
background:#FFFF99;
}