<?php
session_start();

$var=$_REQUEST['var'];

if($var=="logout"){
//session_unset();
session_destroy();
$_SESSION['USERNAME'] ="";
//echo "<h3>La session est termin�e</h3>";
echo "<meta http-equiv='refresh' content='0; url=index.php'>";

}
?>


<?php
include("connexion.php");
?>





<!DOCTYPE html>
<html dir="ltr" lang="fr">
<head>
<LINK rel="shortcut icon" href="img/logo2.png">

<meta name="robots" content="none">
<meta name="robots" content="noindex, nofollow"/>

           <!--link css-->
<link rel="stylesheet" href="script/jquery_003.css" media="all" type="text/css">


                        <!--script-->
<script src="script/analytics.js" async=""></script>
<script src="scripts/jquery-1.js" type="text/javascript"></script>
<script src="script/jquery_004.js"></script>
<script src="script/jquery-ui-1.js" type="text/javascript"></script>
<script src="script/custom.js" type="text/javascript"></script>
<script src="script/jquery_009.js"></script>
<script src="script/jquery_006.js" type="text/javascript"></script>
<script src="script/jquery_010.js"></script>
<script src="script/jquery.js" type="text/javascript"></script>
<script src="script/jquery_011.js" type="text/javascript" charset="utf-8"></script>
<script src="script/jquery_005.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="script/jquery_007.js"></script>
<script type="text/javascript" src="script/jquery_002.js"></script>
<script type="text/javascript" src="script/website.js"></script>
<script type="text/javascript" src="script/swfobject.js"></script>
<script type="text/javascript" src="script/jquery_003.js"></script>  
<script src="script/jquery_008.js" type="text/javascript" charset="utf-8"></script>

	<script type="text/javascript">
    $(window).load(function(){ //$(window).load() must be used instead of $(document).ready() because of Webkit compatibility
    
    // Sliderkit photo gallery > With captions
    $(".photosgallery-captions").sliderkit({
        navscrollatend: true,
        mousewheel:false,
        keyboard:true,
        shownavitems:4,
        auto:false,
        fastchange:true
    });    
    });
    </script>
    
    
		<script type="text/javascript">
			// <![CDATA[
				
			$(document).ready(function () {
				$('#menu').tabify();
				$('#menu2').tabify();
				$(".ajax").colorbox();
				//$(".inline").colorbox({inline:true, width:"70%"});
			
			
			if($(document).width()>1820)
				{
				$(".inline").colorbox({inline:true, width:"1280px"});
				}
				
			else if($(document).width()>1240)
				{
				$(".inline").colorbox({inline:true, width:"95%"});
				}
				
			else
				{
				$(".inline").colorbox({inline:true, width:"95%"});
				}
				
				});	
			// ]]>
		</script>
<script>
 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

 ga('create', 'UA-39127772-1', 'auto');
 ga('send', 'pageview');

</script>

  <script type="text/javascript">
			$(document).ready(function () {
				$("#select-gender").click(function(){
				$('.gender-list').slideToggle(200);
				});
			});
			</script>
            
            <script type="application/javascript" language="javascript">
			function change_gender(val)
			{
				 $('#select-gender').html(val);
				 $('.gender-list').slideToggle(200); 
			}
			</script> 
            
            

<!--FIN LULU MALL -->
<title>connexion</title>

    <link rel="stylesheet" type="text/css" href="Mobile_fichiers/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="Mobile_fichiers/font-awesome.css">
    <link rel="stylesheet" type="text/css" href="Mobile_fichiers/uniform.css">
    <link rel="stylesheet" type="text/css" href="Mobile_fichiers/stylesheet.css">
	<link href="Mobile_fichiers/css_002.css" rel="stylesheet" type="text/css">
    <link href="Mobile_fichiers/css.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" media="screen" href="Mobile_fichiers/superfish.css">
    
	

<link href="script/net.css" rel="stylesheet" type="text/css" media="only screen and (min-width:1241px) and (max-width:1660px)">


</head>


<body>



<div id="bodyWrapper">

    
    
<div class="content-wrapper">
	<div id="bodyContent">
    <!-- header wrapper end -->
	<div class="container">
	  <div class="row">
	        	<div id="centerColumn" class="col-xs-12">

<center><h2 class="page-heading">CPanel Administrateur</h2><p style="margin-top:-20px"></p></center>

<center>

<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded">
<fieldset style="width:500px">
<table>
	<tbody>
    	<tr>
        	<td style="font-size:18px" width="120px" height="50px"><b>Utilisateur</b></td>
        	<td width="200px"><input type="text" size="30px" name="username"/></td>
        </tr>
        
        <tr>
        <td style="font-size:18px" width="120px" height="50px"><b>Mot de passe</b></td>
        <td width="200px"><input type="password" size="30px" name="password"/></td>
        </tr> 
        
        <tr>
        	<td></td>
            <td><input type="submit" class="cart btn btn-primary" class="info btn btn-default" name="envoi" value="CONNEXION"/></td>  
        </tr>        
    </tbody>
</table>

        
</fieldset>
</form>


<?php
//CONNEXION
$Username=isset($_POST["username"]);
$Password=isset($_POST["password"]);
$var=isset($_POST["envoi"]);
/*
echo $var,'<br/>';
echo $code,'<br/>';
echo $article,'<br/>';
echo $prix,'<br/>';
*/

if($var==""){

}

else{
if($_POST["envoi"]=="CONNEXION")
{
$Username=$_POST["username"];
$Password= $_POST["password"];

$info="SELECT * FROM cms_adm WHERE username='$Username'";
$USERNAME="";
foreach($connexion->query($info) as $row){
$USERNAME=$row['username'];
$PASSWORD=$row['password'];
//$PHOTO=$user->photo;
$STATUS=$row['status'];
$ACCES=$row['acces'];
}

//$_SESSION['username']= $_SESSION['username']."//".$Username;
//$_SESSION['password']= $_SESSION['password']."//".$Password;


if($STATUS=="Yes"){
if(!$USERNAME==""){

if(($Username==$USERNAME) && ($Password==$PASSWORD)){
//administrateur_user.php
$_SESSION['USERNAME'] = $USERNAME;
$_SESSION['ACCES'] = $ACCES;


echo "<meta http-equiv='refresh' content='0; url=dashboard.php?id='>";
}

else{
echo "<script type=\"text/javascript\">alert (\"Les informations saisies sont incorrectes !\")</script>";
}

}
else{
echo "<script type=\"text/javascript\">alert (\"L'Utilisateur $Username n'est pas reconnu !\")</script>";
}
}

else{
echo "<script type=\"text/javascript\">alert (\"L'Utilisateur $Username n'a pas l'acc�s !\")</script>";
}

}


}

//VERIFIER
if($var==""){

}

else{
if($_POST["envoi"]=="VERIFIER")
{
echo "<table border=\"1\" >";
echo "<tr><td colspan=\"3\"><b>R�capitulatif de votre commande</b></td>";
echo "<tr><th>&nbsp;code&nbsp;</th><th>&nbsp;article&nbsp;</ th><th>&nbsp;
prix&nbsp;</th>";
$total=0;
$tab_code=explode("//",$_SESSION['code']);
$tab_article=explode("//",$_SESSION['article']);
$tab_prix=explode("//",$_SESSION['prix']);
$prixtotal=0;

for($i=1;$i<count($tab_code);$i++)
{
echo "<tr> <td>{$tab_code[$i]}</td> <td>{$tab_article[$i]}</td><td>".sprintf("%01.2f", $tab_prix[$i])."</td>";
$prixtotal+=$tab_prix[$i];
}
echo "<tr> <td colspan=2> PRIX TOTAL </td> <td>".sprintf("%01.2f", $prixtotal)."</td>";
echo "</table>";
}

}

//ENREGISTRER
if($var==""){

}

else{
if($_POST["envoi"]=="ENREGISTRER")
{
$idfile=fopen("commande.txt",w);
//
$tab_code=explode("//",$_SESSION['code']);
$tab_article=explode("//",$_SESSION['article']);
$tab_prix=explode("//",$_SESSION['prix']);
for($i=0;$i<count($tab_code);$i++)

{
fwrite($idfile, $tab_code[$i]." ; ".$tab_article[$i]." ; ".$tab_prix[$i].";
\n");
}
fclose($idfile);
}

}
//VIDER LE PANIER
if($var==""){

}

else{
if($_POST["envoi"]=="VIDER LE PANIER")
{
session_unset();
session_destroy();

$user=fopen("user.txt","w+");
fputs($user,"");
fclose($user);

echo "<h3>La session est termin�e</h3>";

}

}
$_POST["envoi"]="";

?>
</center>

<br/>
<br/>
</div>

</div>
</div>



<!--    <div class="scroll-wrap" id="scroll-01">
    <div class="simply-scroll simply-scroll-container"> 
       
    <div class="simply-scroll-clip"><ul style="width: 38191px; margin-right:auto;" class="scroller simply-scroll-list">
    

                   
              </ul>
              </div>
    </div>
    </div>-->
    
    
    
    
<!-- content-wrapper -->
<div class="footer-wrapper">
        	<div class="container">
	            <div class="row">
  
<div class="container well">
	<div class="footer">
		 
			<div class="footer-boxes">
                            <div class="row">
                            <br/>
                            <div style="background-color:#CCCCCC;">
                                
                            </div>    
            
            </div>
                 </div>
    </div>
</div>
             </div>
</div>
<!-- bodyWrapper //--> 

<script type="text/javascript">/* CloudFlare analytics upgrade */
</script>
<script type="text/javascript">window.NREUM||(NREUM={});NREUM.info={"beacon":"bam.nr-data.net","licenseKey":"72d7dcce33","applicationID":"1388850","transactionName":"ZV1TZ0FTVkFVWkwKXlwXZEFaHVdBV2YNVgEBDx5aXVZdShpJUBM=","queueTime":0,"applicationTime":2031,"atts":"SRpQEQlJRU8=","errorBeacon":"bam.nr-data.net","agent":""}</script><noscript><iframe src="" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push( {'gtm.start': new Date().getTime(),event:'gtm.js'} );var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=''+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-N7VWVN');</script> <!-- End Google Tag Manager --></div></div></div>
</div><div style="display: none;" id="cboxOverlay"></div><div style="display: none;" tabindex="-1" role="dialog" class="" id="colorbox"><div id="cboxWrapper"><div><div style="float: left;" id="cboxTopLeft"></div><div style="float: left;" id="cboxTopCenter"></div><div style="float: left;" id="cboxTopRight"></div></div><div style="clear: left;"><div style="float: left;" id="cboxMiddleLeft"></div><div style="float: left;" id="cboxContent"><div style="float: left;" id="cboxTitle"></div><div style="float: left;" id="cboxCurrent"></div><button id="cboxPrevious" type="button"></button><button id="cboxNext" type="button"></button><button id="cboxSlideshow"></button><div style="float: left;" id="cboxLoadingOverlay"></div><div style="float: left;" id="cboxLoadingGraphic"></div></div><div style="float: left;" id="cboxMiddleRight"></div></div><div style="clear: left;"><div style="float: left;" id="cboxBottomLeft"></div><div style="float: left;" id="cboxBottomCenter"></div><div style="float: left;" id="cboxBottomRight"></div></div></div><div style="position: absolute; width: 9999px; visibility: hidden; display: none; max-width: none;"></div></div>
<div id="fancybox-wrap"><div id="fancybox-outer"><div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>
    <a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a><a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a></div>
</div>

</div>
</body><!-- Google Tag Manager --></html>