Sid Gifari From Gifari Industries - BD Cyber Security Team
Home
/
home
/
airmobeuag
/
2020
/
commande_v2
/
✏️
Editing: commande.v2.php
<!doctype html> <html lang="fr"> <head> <!-- Google Tag Manager --> <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= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-KP74Q3L');</script> <!-- End Google Tag Manager --> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.0/css/all.css" integrity="sha384-aOkxzJ5uQz7WBObEZcHvV5JvRW3TUc2rNPA7pe3AwnsUohiw1Vj2Rgx2KSOkF5+h" crossorigin="anonymous"> <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <!-- <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>--> <link rel = "stylesheet" href = "css/airmob.css?<?=time();?>"> <link rel = "stylesheet" href = "css/switch.css?<?=time();?>"> <link rel = "stylesheet" href = "css/step.css?<?=time();?>"> <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Quicksand" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet"> </head> <body > <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KP74Q3L" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <?php session_start(); error_reporting(E_ALL); ini_set("display_errors", 0); /* * Arrive directemetn sur une commande * INTERNET http://127.0.0.1/airmob/commande_v2/commande.v2.php?type=i&p=30 * TELEPHONIE http://127.0.0.1/airmob/commande_v2/commande.v2.php?type=t&p=50 * FIBRE http://127.0.0.1/airmob/commande_v2/commande.v2.php?type=f&p=100 * * CODE:STRIPE * */ // Prérequis include_once ("./lib/gestion.lib.php"); $ClassCdeV2 = new ClassCdeV2(); // unset( $_SESSION['AIRCMDV2']);exit; // Expiration de la commande fixé à 1h if( $_SESSION['AIRCMDV2']['Cde_debut'] && date('Y-m-d H:i:s')> $_SESSION['AIRCMDV2']['Cde_debut'] ) { unset( $_SESSION['AIRCMDV2'] ); $MsgExpiration = "Votre commande a expirée...!"; } // Charge les produits unset($_SESSION['AIRCMDV2']['Produits']); $ClassCdeV2->ListeProduits(['data_i', 'opt_i','data_t','opt_t','data_f','opt_f']); // Si pas d etape précisée if (!$_REQUEST['e']) { $_SESSION['AIRCMDV2']['etape']="1"; if ($_REQUEST['type']<>'f') unset($_SESSION['AIRELIG']); // Autre que type Fibre suppriem lasession } // $_SESSION['AIRCMDV2']['type'] = $_REQUEST['type']; // Deternime la commande type Internet ou Telephonie if ( $_GET['p'] ){ // Numero du produit en cours $NoProduit = count($_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['1']); $NomProduit = $_SESSION['AIRCMDV2']['NomProduits'][$_REQUEST['p']]['nom']; // 1 if($NoProduit==0) { $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['1'][$NoProduit+1] = ['id' => $_REQUEST['p']]; // } else { // CONFIRME donc passer au suivant if($_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['1'][$NoProduit]['confirme']=="OK"){ } // NON CONFIRME donc reste sur celui en cours else { $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['1'][$NoProduit] = ['id' => $_REQUEST['p']]; // } } } if ($_GET['e'] ) $_SESSION['AIRCMDV2']['etape']=$_GET['e']; // Se postionner sur Etape if ($_POST['btn_suivant']) $_SESSION['AIRCMDV2']['etape']=$_POST['btn_suivant']; // Suivant else if ($_POST['btn_precedent']) $_SESSION['AIRCMDV2']['etape']=$_POST['btn_precedent']; // Précédent // Préchagre en Etape 2 les 2 x options Si pas de commmande en cours if(empty($_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']) ) { if ($_REQUEST['type'] == "t" && $_SESSION['AIRCMDV2']['etape'] == 2) { $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['1']['id'] = "0"; //"54"; $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['2']['id'] = "0"; // "55"; } if ($_REQUEST['type'] == "i" && $_SESSION['AIRCMDV2']['etape'] == 2) { $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['1']['id'] = "0";// 40 $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['2']['id'] = "0"; //41 $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['3']['id'] = "0"; //42 $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['4']['id'] = "0"; //43 } if ($_REQUEST['type'] == "f" && $_SESSION['AIRCMDV2']['etape'] == 2) { $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['1']['id'] = "0";// $_SESSION['AIRCMDV2']['Commande'][$_REQUEST['type']]['2']['2']['id'] = "0"; // } } // POST les forms $ClassCdeV2->PostForm(); ?> <div class="container"> <?php //echo "<h1>MAINTENANCE en COURS...</h1>"; //exit; ?> <?=$ClassCdeV2->AfficheSuiviEtape();?> <?php if($MsgExpiration) {?> <div class="alert alert-danger"> <div style='text-align:center'><strong><?=$MsgExpiration?></strong><br>Vous pouvez en redémarrer une nouvelle.</div> </div> <?php } ?> <div class="row"> <div class="col-lg-8"> <?php if ($_SESSION['AIRCMDV2']['etape']< 5 ) $action =""; else $action ="stripe.confirme.php"; $TotalFact = $_SESSION['AIRCMDV2']['TotalCmd']; $MontantCB = $TotalFact*100; // CODE:NEW nouvelle gestion des rewrite if($_REQUEST['type']=="i") $NomRewrite = "internet"; if($_REQUEST['type']=="t") $NomRewrite = "telephonie"; if($_REQUEST['type']=="f") $NomRewrite = "fibre"; $UrlForm=$NomRewrite."-commander"; if ($_SESSION['AIRCMDV2']['etape']=="1") $UrlForm=$NomRewrite."-commander-options"; elseif ($_SESSION['AIRCMDV2']['etape']=="2") $UrlForm=$NomRewrite."-commander-informations"; elseif ($_SESSION['AIRCMDV2']['etape']=="3") $UrlForm=$NomRewrite."-commander-entreprise"; elseif ($_SESSION['AIRCMDV2']['etape']=="4") $UrlForm=$NomRewrite."-commander-paiement"; elseif ($_SESSION['AIRCMDV2']['etape']=="5") $UrlForm="thank-you?noc=".$_SESSION['AIRCMDV2']['idunique']."&amount=".$MontantCB; $action = $UrlForm; ?> <form id="payment-form" method="post" action="<?=$action?>" data-secret="<?= $intent->client_secret ?>"> <?php // Affiche le Form de l'etape courante $ClassCdeV2->AfficheFormEtape(); ?> <br> <div style="text-align:center"> <?php if ($_SESSION['AIRCMDV2']['etape']< 5 ){ $btnSuivant = $_SESSION['AIRCMDV2']['Param']['btnSuivant']; if($btnSuivant=="disabled") $class = "btn-suivdis"; else $class = "btn-suivant"; ?> <button class="<?=$class?>" id="btn_suivant" name="btn_suivant" type="submit" value="<?=($_SESSION['AIRCMDV2']['etape']+1)?>" <?=$btnSuivant?> > SUIVANT </button> <br><br> <?php if ($_SESSION['AIRCMDV2']['etape'] > 1) { ?> <button class="btn-retour " name="btn_precedent" type="submit" value="<?=($_SESSION['AIRCMDV2']['etape']-1)?>" OnClick="javascript:AnnuleReq(<?=$_SESSION['AIRCMDV2']['etape']?>);"> RETOUR </button><br><br> <?php } ?> <?php } ?> </div> </form> <?php //if($_REQUEST['type']=="f") { ?> <div style="border:2px solid #245BA5; border-radius:10px; text-align:center; color:#245BA; padding:20px"> <h6>N'hésitez pas à nous contacter pour toute information supplémentaire: <br>Disponible du Lundi au Samedi de 08 à 18h</h6> <h5 style="font-weight:bold;">05 82 99 31 31 </h5> </div> <?php //} ?> </div> <div class="col-lg-4" > <div class="card" style="border:1px solid #245ba5; border-bottom-right-radius: 20px; border-bottom-left-radius: 20px;"> <div class="card-header" style="background: #245ba5; color:#fff; font-size:1em"><img src="images/panier.svg"> <b>Mon panier</b> </div> <div class="card-body" id="MonPanier"> <?php //include ("form/panier.php"); ?> </div> <?php if ($_SESSION['AIRCMDV2']['etape']<4) { ?> <small style="position:relative; margin-left:20px; margin-bottom:10px;">(<a href="javascript:Recommencer('<?=$_REQUEST['type']?>','<?=$_REQUEST['p']?>')">Vider votre panier</a>)</small> <?php } ?> </div> </div> </div> </div> </div> <br><br><br><br> <script> // Vide le panier function Recommencer(t,p){ if ( confirm( "Voulez-vous vraiement recommencer votre commande\net vide votre panier ?\n\nSi oui, cliquez sur le bouton OK" ) ) { $.ajax({ type: "POST", url: "./lib/cmd.ajax.php?action=reset", async: true, success: function (response) { if(t=="i") location=('internet-commander') if(t=="t") location=('telephonie-commander') // location=('commande.v2.php?type='+t+'&p='+p) } }); } else { // Code à éxécuter si l'utilisateur clique sur "Annuler" } } // Supprime un forfait function SupprForfait( type , etape , key_panier ,p) { if ( confirm( "Voulez-vous supprimer ce forfait ?\n\nSi oui, cliquez sur le bouton OK" ) ) { location=('commande.v2.php?type='+type+'&p='+p+"&a") $.ajax({ type: "POST", url: "./lib/cmd.ajax.php?action=supprforfait&type="+type+"&etape="+etape+"&key="+key_panier, async: true, success: function (response) { location=('commande.v2.php?type='+type+'&p='+p) } }); } else { // Code à éxécuter si l'utilisateur clique sur "Annuler" } } $('#MonPanier').load("./form/panier.php"); // Controle BtnSuivant function ControleBtnSuivant ( etape ) { var btnSuivant; id = $(this).attr("id"); id2 = $('#'+event.target.id).attr("id"); name2 = $('#'+event.target.id).attr("name"); ref = $('#'+event.target.id).attr("ref");; // ref = id de référence du produit var Ligne = id2.split('_'); console.debug('Recharge le panier '+id2+" / L"+Ligne[1]+ " / Id:"+Ligne[2]+" / "+name2 ); // $('#MonPanier').load("./form/panier.php"); // Operateur if(etape==1){ n = name2.split('_'); // ligne={etape},{numero article},{id article} if(n[1]=="DATA") { console.debug('AJAX'); $.ajax({ type: "POST", url: "./lib/cmd.ajax.php?action=recharge&ligne=<?=$_REQUEST['type']?>,"+etape+","+Ligne[1]+","+Ligne[2], async: true, success: function (response) { $('#MonPanier').load("./form/panier.php"); } }); } $('[name^="Choix"]').each(function () { id = $(this).attr("id"); // DEJA Une carte SIM if($("#ID_1_0").is(':checked')==true) { $("#Choix_OPE_1" ).prop('required', false); $("#Choix_OPE_1" ).val(''); $("#DIV_TEL_1" ).css('display', 'block'); $("#Choix_TEL_1" ).prop('required', true); if( $("#Choix_TEL_1").val() ) btnSuivant="enabled"; else btnSuivant="disabled"; console.debug( "-->"+$("#Choix_TEL_1").val() +"--> "+btnSuivant); } else { console.debug( "-->"+$("#Choix_TEL_1").val() +"--> "+btnSuivant); $("#DIV_TEL_1" ).css('display', 'none'); $("#Choix_TEL_1" ).val(''); $("#Choix_TEL_1" ).prop('required', false); $('select[class^="listeOpe"]').each(function () { if($("#"+id).val()=='' ) btnSuivant="disabled"; else btnSuivant="enabled"; }); } //if($("#ID_1_101").is(':checked')==true || $("#ID_1_102").is(':checked')==true || $("#ID_1_103").is(':checked')==true) { if(Ligne[2]>100) { btnSuivant="enabled"; $("#DIV_ABO_1" ).css('display', 'block'); } else if(Ligne[2]==100) { btnSuivant="enabled"; $("#DIV_ABO_1" ).css('display', 'none'); } else { } }); Go(btnSuivant); } else if( etape==2) { // Affiche la Qté if(ref!='42') { // livraison express if (Ligne[2] > 0) $('#DIVQTE_' + ref).css('display', 'block'); else $('#DIVQTE_' + ref).css('display', 'none'); } if(id2=="ID_3_43") { console.log("desactive livraison express"); $('#ID_4_0').prop('checked',true); } // 4G ou 5G if (id2=="ID_2_41") $('#ID_3_43').prop('disabled',true); else if (id2=="ID_2_0" ) $('#ID_3_43').prop('disabled',false); else if (id2=="ID_3_43") { $('#ID_2_41').prop('disabled',true); $('#ID_4_42').prop('disabled',true);// Livraison Express } else if (id2=="ID_3_0") { //$('#QTE_3_43').val('0'); $('#ID_2_41').prop('disabled',false); $('#ID_4_42').prop('disabled',false); // Livraison Express } /* // Si LIVRAISON EXPRESS Check else if (id2=="ID_4_42") { $('#ID_3_43').prop('disabled',true); $('#ID_3_0').prop('checked',true); $('#ID_4_0').prop('checked',true); $('#QTE_3_43').val('0'); } // Si LIVRAISON EXPRESS Uncheck else if (id2=="ID_4_0") { // $('#ID_3_43').prop('disabled',false); } */ n = name2.split('_'); // ligne={etape},{numero article},{id article} if(n[1]=="OPT1" || n[1]=="OPT2" || n[1]=="OPT3" || n[1]=="OPT4" || n[0]=="QTE") { console.log('AJAX 2 '+Ligne[1]+" "+Ligne[2]); $.ajax({ type: "POST", url: "./lib/cmd.ajax.php?action=recharge&ligne=<?=$_REQUEST['type']?>,"+etape+","+Ligne[1]+","+Ligne[2]+"&qte="+$('#QTE_'+Ligne[1]+'_'+Ligne[2]).val(), async: true, success: function (response) { // alert(response); $('#MonPanier').load("./form/panier.php"); } }); } } else if (etape==3) { n = id2.split('_'); setTimeout(() => { if ( !$("#form_nomprenom").val() || !$("#form_email").val() || !$("#form_telephone").val() || $('input[name=onoffswitch]:checked').val()!="oui") { btnSuivant="disabled"; } else { btnSuivant="enabled"; } Go(btnSuivant); }, 500); } else if (etape==4) { n = name2.split('_'); if ( !$("#form_nomsociete").val() || !$("#form_nofacturation").val() || !$("#form_adrfacturation").val() || !$("#form_cpfacturation").val() || !$("#form_villefacturation").val()) { btnSuivant="disabled"; } else { btnSuivant="enabled"; } Go(btnSuivant); } else if (etape==5) { console.log('CodePROMO'+$('#description').val()); $.ajax({ type: "POST", url: "./lib/cmd.ajax.php?action=codePromo&ligne=<?=$_REQUEST['type']?>,"+etape+",codepromo,1&qte=1&codepromo="+$('#description').val(), async: true, success: function (response) { // alert(response); $('#MonPanier').load("./form/panier.php"); location.reload(); } }); // Go(btnSuivant); } } // BtnSuivant function Go(btnSuivant) { if(btnSuivant=="enabled") { $("#btn_suivant").prop("disabled", false); $("#btn_suivant").addClass('btn-suivant'); $("#btn_suivant").removeClass('btn-suivdis'); } else { $("#btn_suivant").prop("disabled", true); $("#btn_suivant").addClass('btn-suivdis'); $("#btn_suivant").removeClass('btn-suivant'); } } // Duplqiue ADR function DupliqueAdr() { if( $('#MemeAdr').is(':checked')==true ) { $( "#form_nolivraison" ).val( $( "#form_nofacturation" ).val() ); $( "#form_adrlivraison" ).val( $( "#form_adrfacturation" ).val() ); $( "#form_cplivraison" ).val( $( "#form_cpfacturation" ).val() ); $( "#form_villelivraison" ).val( $( "#form_villefacturation" ).val() ); } else { $( "#form_nolivraison" ).val(''); $( "#form_adrlivraison" ).val( ''); $( "#form_cplivraison" ).val('' ); $( "#form_villelivraison" ).val(''); } } $('.form_porta_mobile-checkbox').click(function() { id = $(this).data('num') ; if ($(this).is(':checked')) ActivePortaMobile(id) // AVEC PORTA else DesactivePortaMobile(id); // SANS PORTA }); // Garder No Tel function ActivePortaMobile(id) { $('#GardeNumero_'+id ).css('display','block'); $("#Porta_NUM_"+id ).prop('required', true); $("#Porta_RIO_"+id ).prop('required', true); } function DesactivePortaMobile(id) { $('#GardeNumero_'+id ).css('display','none'); $("#Porta_NUM_"+id ).removeAttr("required"); $("#Porta_NUM_"+id ).val(''); $("#Porta_RIO_"+id ).removeAttr("required"); $("#Porta_RIO_"+id ).val(''); //$("#form_nomprenom_mobile" ).val(''); } // Reout/Annule required function AnnuleReq( etape ){ if(etape==3 || etape==4){ $('[name^="form_"]').each(function () { id = $(this).attr("id"); $("#"+id).prop('required',false); }); } } </script> </body> </html>
💾 Save
❌ Cancel