. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 213.186.33.4 / Your IP :
216.73.216.146 [
Web Server : Apache System : Linux webm002.cluster103.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : dealkatnwc ( 662330) PHP Version : 7.0.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/dealkatnwc/www/wp-custom/ |
Upload File : |
<style>header.entry-header{display: none;}</style>
<style>.asteriskField{color: red;} .input-group{margin: 5px;} .input-group-addon{width: 44%;text-align: left;} </style>
<?php
if (!( isset($_POST['deal_id']) )) {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=1';</script>";}
if (!( is_user_logged_in() )) {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=2';</script>";}
if (get_post_type( $_POST['deal_id'] ) != 'deal') {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=3';</script>";}
if (get_post_meta( $_POST['deal_id'], 'wpcf-date-d-expiration', true ) < time()) {echo "<script>document.location.href='".get_bloginfo('url')."/404.php/?erreur=4';</script>";}
global $current_user;
get_currentuserinfo();
$titre = get_the_title($_POST['deal_id']);
$prix_promo = get_post_meta( $_POST['deal_id'], 'wpcf-prix-promo', true );
if ((isset($_POST['PAL'])) && ($_POST['PAL'] == 'oui'))
{
mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db(DB_NAME);
$sql="UPDATE `prd_coupons` SET etat='7', addr='".utf8_decode($_POST['CustAddress']).', '.$_POST['CustZIP'].' '.utf8_decode($_POST['CustCity'])."' WHERE `prd_coupons`.`code_cmd` =".$_POST['PAYID'];
mysql_query($sql);
?>
<div class="alert alert-info" role="alert">
<p> <?php echo $_POST['dealer_prenom']; ?>! vous avez demandé la livraison de votre coupon, La livraison peut prendre de 1 à 7 Jours.</p>
<p>N° Commande: <b><?php echo $_POST['PAYID']; ?></b></p>
<p>Adresse de livraison : <?php echo $_POST['CustAddress'].', '.$_POST['CustZIP'].' <b>'.$_POST['CustCity'].'</b>' ; ?></p>
<p>Pour plus d'information, contactez 96 46 56 66 / 79 218 968.</p>
</div>
<center>
<img src="<?php echo get_template_directory_uri(); ?>/images/livreur.png" class="img-responsive" alt="">
</center>
<?php
}
else {
?>
<h1>Votre commande</h1>
<table class="table table-bordered">
<thead>
<tr>
<th width="25%">Produit</th> <th width="50%">Offre</th> <th width="10%">Quantité</th> <th width="15%">Prix</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="img-hover" scope="row">
<?php echo '<img src="'.wp_get_attachment_url( get_post_thumbnail_id($_POST['deal_id']) ).'" class="img-responsive" alt="">';?>
</div>
</td>
<td><a href="<?php echo get_page_link($_POST['deal_id']);?>" target="_blanc"><?php echo $titre;?></a></td> <td><?php echo $_POST['quantite']; ?></td>
<td><?php echo $prix_promo;?><sup>DT</sup></td>
</tr>
</tbody>
<tbody>
<tr class="text-center">
<th scope="row" colspan="3" class="text-center">Total <sub>(Hors frais de livraison)</sub></th>
<td ><b><?php echo $prix_promo * $_POST['quantite'];?></b><sup>DT</sup></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th width="65%">Zone (Gouvernorat)</th><th width="35%">Frais de livraison (du coupon)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ben Arous </td><td><b> 5 <sup>Dt</sup></b></td>
</tr>
<tr>
<td>Ariana, La Manouba, Tunis</td><td><b> 7 <sup>Dt</sup></b></td>
</tr>
<tbody>
</table>
<?php
////on insérer dans la commande
global $wpdb;
$orderID=time();
$test = false;
// tester que le numéro de cmd est unique
while($test == false)
{$nb = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}coupons WHERE code_cmd = '".$orderID."' ");if ($nb==0) {$test = true;} else {$orderID++;}}
$wpdb->insert($wpdb->prefix.'coupons', array( 'id' => NULL,
'code_cmd' => $orderID,
'deal_id' => $_POST['deal_id'],
'id_vendeur' => 0,
'dealer_nom' => $_POST["dealer_nom"],
'dealer_prenom' => $_POST["dealer_prenom"],
'dealer_tel' => $_POST["dealer_tel"],
'dealer_sex' => $current_user->gender,
'dealer_gouv' => $current_user->gouvernorat,
'dealer_email' => $_POST["dealer_email"],
'date_coupon' => $orderID,
'quantite' => $_POST["quantite"],
'etat' => 0,
'mailing' => 0,
'recu' => 0),
array( '%d', '%d', '%d','%d', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) );
$CustAddress=$current_user->address; //$current_user->address
$CustZIP=$current_user->code_postale; //$current_user->code_postale
$CustCity=$current_user->gouvernorat; //$current_user->ville
?>
<FORM name='paiment' method='POST' action=''>
<input type='hidden' name='PAL' value='oui'>
<input type='hidden' name='PAYID' value='<?php echo $orderID;?>'>
<input type='hidden' name='deal_id' value='<?php echo $_POST['deal_id'];?>'>
<div class="panel panel-default">
<div class="panel-heading text-center"><b>Adresse de livraison</b></div>
<div class="panel-body">
<div class="row">
<div class="col-md-9 col-sm-9 col-xs-12">
<div class="input-group col-xs-12">
<span class="input-group-addon">Adresse <span class="asteriskField">*</span></span>
<input type="text" class="form-control" id="CustAddress" name="CustAddress" placeholder="" aria-label="Adresse" value='<?php echo $CustAddress;?>' pattern='^[a-zA-Zéèàîìôòùû0-9 ]{3,100}$' title='L`adresse doit être composer des lettres et des chiffres de taille varie entre 4 et 100 carractére' required>
<label class="control-label requiredField" for="CustAddress"></label>
</div>
<div class="input-group col-xs-12">
<span class="input-group-addon">Code Postale <span class="asteriskField">*</span></span>
<input type="text" class="form-control" id="CustZIP" name="CustZIP" placeholder="" aria-label="Code Postale" value='<?php echo $CustZIP;?>' pattern='^[0-9]{4}$' title='Le code postale doit être composer de 4 chiffres.' required>
<label class="control-label requiredField" for="CustZIP"></label>
</div>
<div class="input-group col-xs-12">
<span class="input-group-addon">Gouvernorat <span class="asteriskField">*</span></span>
<select id="CustCity" name="CustCity" aria-label="Gouvernorat" class="form-control" required>
<option value="Ariana">Ariana</option>
<option value="Ben Arous">Ben Arous</option>
<option value="Manouba (La)">Manouba (La)</option>
<option value="Tunis">Tunis</option>
</select>
<script>document.getElementById("CustCity").value = "<?php echo $CustCity; ?>";</script>
<label class="control-label requiredField" for="CustCity"></label>
</div>
<input type="hidden" id="prixnet" name="prixnet" value='<?php echo $prix_promo * $_POST['quantite'];?>'>
<div class="input-group col-xs-12">
<span class="input-group-addon"><b>Totale à Payer </b></span>
<input type="hidden" id="ttap" name="ttap" value=''>
<h2 style="text-align: center;"><span id='ttap_txt'></span> </h2>
</div>
<script>
jQuery(document).ready(function() {changettapvalue ();});
$("#CustCity" ).change(function() {changettapvalue ();});
function changettapvalue () {
var city=$('#CustCity').find('option:selected').text();
var prixnet=$('#prixnet').val();
var ttap = 0;
if (city == "Ben Arous" ) ttap = parseInt(prixnet) + 5 ;
else ttap = parseInt(prixnet) + 7 ;
$('#ttap').val(ttap);
$('#ttap_txt').html('<i class="fa fa-refresh fa-spin" aria-hidden="true"></i>');
setTimeout(function(){$('#ttap_txt').html(ttap+'<sup>Dt</sup>')} ,1000);
}
</script>
</div>
<div class="col-md-3 col-sm-3 col-xs-12 text-center">
<img src="<?php echo get_template_directory_uri(); ?>/images/livreur.png" class="img-responsive" alt="">
</div>
</div>
</div>
<div class="panel-footer">
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12 text-right pull-right">
<button class="btn btn-primary " name="submit" type="submit">
<i class="fa fa-truck"></i> Valider
</button>
</div>
<div class="col-md-6 col-sm-6 col-xs-12 text-left">
<a href="<?php echo get_page_link($_POST['deal_id']);?>"><i class="fa fa-long-arrow-left"></i> Retour</a>
</div>
</div>
</div>
</div>
</form>
<?php } ?>