1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
|
<?php
@$btcom=$_POST["commander"];
@$prixpw=$_POST["prixpw"];
@$prixu=$_POST["prixu"];
@$comm=$_POST["comm"];
@$mavance=$_POST["mavance"];
@$qte=$_POST["qte"];
@$idpays=$_POST["pays"];
@$idville=$_POST["ville"];
$res = mysql_query("SELECT * FROM pw_pays where id='".$idpays."'") or die("<html><body><script language=javascript>alert('Impossible d\'effectuer la requête')</script></body></html>");
$valp=mysql_fetch_array($res);
$res = mysql_query("SELECT * FROM pw_ville where id='".$idville."'") or die("<html><body><script language=javascript>alert('Impossible d\'effectuer la requête')</script></body></html>");
$valv=mysql_fetch_array($res);
$pays=$valp["nompays"];
$ville=$valv["nomville"];
$ptchute=$valv["pointchute"];
//echo"<br> Le pays est : ".$pays;
//echo"<br> La ville est : ".$ville;
//echo" <br> Livraison à choisi";
$cal=($prixpw*$valv["pourcentage"])/100;
$prixpw1=($prixpw+$cal);
if(isset($btcom))
{
if(@$_POST["nom_article"]!="Nom de l'article")
{
@$nom_art=$_POST["nom_article"];
}
if(@$_POST["nom_categorie"]!="")
{
@$nom_art=$_POST["nom_categorie"];
}
}
?>
<!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=iso-8859-1" />
<title>Document sans titre</title>
<link href="css/pwb_css.css" rel="stylesheet" type="text/css" />
<link href="css/template_css.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function verif(simulateur)
{
with(document.simulateur)
{
var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/
if(reg.exec(email.value)==null)
{
alert("L'adresse e-mail saisie est invalide");
email.focus();
return false;
}
if(prenom.value=="")
{
alert("Veuillez renseigner votre prénom !!!!");
prenom.focus();
return false;
}
if(nom.value=="")
{
alert("Veuillez renseigner votre nom !!!!");
nom.focus();
return false;
}
if(tel.value=="")
{
alert("Veuillez renseigner votre numéro de téléphone !!!!");
tel.focus();
return false;
}
if(tel.value.length<6)
{
alert("Votre numero de téléphone doit contenir au moins 6 chiffres");
tel.focus();
return false;
}
if(url.value==""||url.value=="http://")
{
alert("Veuillez saisir l'url de l'article !!!!");
url.focus();
return false;
}
if(marque.value=="")
{
alert("Veuillez renseigner la marque de votre produits !!!!");
marque.focus();
return false;
}
if(document.simulateur.choix[0].checked==false && document.simulateur.choix[1].checked==false)
{
alert(" Faite un choix définitif de destination");
return false;
}
}
return true;
}
</script>
<script language="javascript">
function inscrit(simulateur)
{
with(document.simulateur)
{
email.focus();
}
return true;
}
</script>
<script language="javascript">
function videntif(identification)
{
with(document.identification)
{
var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/
if(reg.exec(Iemail.value)==null)
{
alert("L'adresse e-mail saisie est invalide");
Iemail.focus();
return false;
}
if(Ipwd.value=="")
{
alert("Veuillez entrer votre mot de passe !!!!");
Ipwd.focus();
return false;
}
}
//makeRequest('repPhpAjax.php','id_niv1','id_list2');
makeRequest('repPhpAjax.php','id_niv1','id_pwd','id_list2');
return false;
}
</script>
<script language="javascript">
function makeRequest(url,id_niveau,id_passwd,id_ecrire)
{
var http_request = false;
//créer une instance (un objet) de la classe désirée fonctionnant sur plusieurs navigateurs
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');//un appel de fonction supplémentaire pour écraser l'en-tête envoyé par le serveur, juste au cas où il ne s'agit pas de text/xml, pour certaines versions de navigateurs Mozilla
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Abandon :( Impossible de créer une instance XMLHTTP');
return false;
}
http_request.onreadystatechange = function() { traitementReponse(http_request,id_ecrire); } //affectation fonction appelée qd on recevra la reponse
// lancement de la requete
http_request.open('POST', url, true);
//changer le type MIME de la requête pour envoyer des données avec la méthode POST , !!!! cette ligne doit etre absolument apres http_request.open('POST'....
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
//obj=document.getElementById(id_niveau);
//data="val_sel="+obj.value;
obj=document.getElementById(id_niveau);
data="val_sel="+obj.value;
obj1=document.getElementById(id_passwd);
data1="&val_sel1="+obj1.value;
http_request.send(data+data1);
}
function traitementReponse(http_request,id_ecrire) {
var affich="";
if (http_request.readyState == 4) {
if (http_request.status == 200) {
// cas avec reponse de PHP en mode texte:
//chargement des elements reçus dans la liste
var affich_list = http_request.responseText;
obj = document.getElementById(id_ecrire);
if(affich_list=="Votre email ou password n'est pas valide")
{
affich_list=alert("Votre email ou password n'est pas valide");
document.simulateur.email.value="";
document.simulateur.nom.value="";
document.simulateur.prenom.value="";
document.simulateur.tel.value="";
document.simulateur.adresse.value="";
//obj.innerHTML = affich_list;
}
else
{
var temp = affich_list.split("/");
document.simulateur.email.value=temp[0];
document.simulateur.nom.value=temp[1];
document.simulateur.prenom.value=temp[2];
document.simulateur.tel.value=temp[3];
document.simulateur.adresse.value=temp[4];
}
}
else {
alert('Un problème est survenu avec la requête.');
}
}
}
</script>
<style type="text/css">
<!--
.Style2 {
font-size: smaller;
font-weight: bold;
}
.Style4 {font-size: 12px; font-weight: bold; }
-->
</style>
</head>
<body>
<div id="pwb-cnt1">
<div id="pwb-cnt_gradient">
<table class="contentpaneopen">
<tr>
<td class="contentheading">BetaVista® PromoWeb 1.0 Commande</td>
</tr>
</table>
<table class="contentpaneopen">
<tr>
<td valign="top" colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="22" scope="col" align="center">
Si vous avez deja passer une commande sur ce site, veuillez entrez vos informations d'identification; dans le cas comtraire bien vouloir cliquer ici <label onclick="Javascript: inscrit(simulateur);" class="text_area"> <font color="#0099CC">S'inscrire</font></label>. <br /></td>
</tr>
<tr>
<td align="center">
</td>
</tr>
</table>
<div id="id_list2">
</div>
<fieldset><legend class="mainlevel-main" id="active_menu-main"><strong>Identification</strong></legend>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<form id="simulateur" name="identification" method="post" action="" onsubmit="Javascript: return videntif(identification);">
<tr>
<td width="23%">Email: </td>
<td colspan="2"><input name="Iemail" id="id_niv1" type="text" class="inputbox"/></td>
</tr>
<tr>
<td width="23%">Mot de passe:</td>
<td width="28%"><input name="Ipwd" id="id_pwd" type="password" class="inputbox"/></td>
<td width="49%"><input name="identif" type="submit" value="S'identifier" class="button" /></td>
</tr>
</form>
</table>
</fieldset><br />
<form id="simulateur" name="simulateur" action="index.php?menuuser=menuuser.php&menuadmin=menuadmin.php&content=includes/printer.php" onsubmit="Javascript: return verif(simulateur);" style="margin:0px; padding:5px;" method="post">
<div id="id_list2">
</div>
<fieldset><legend class="mainlevel-main" id="active_menu-main"><strong>Informations sur le client</strong></legend>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td height="22" scope="row">Adresse E-Mail :</td>
<td colspan="3"><input name="email" type="text" size="25" class="inputbox" /></td>
</tr>
<tr>
<td height="22" scope="row">Mot de passe :</td>
<td><input name="password" type="text" size="25" class="inputbox" /></td>
<td width="19%" height="22" scope="row">Confirmer :</td>
<td width="19%"><input name="cpassword" type="text" size="25" class="inputbox" /></td>
</tr>
<tr>
<td width="26%" height="22" scope="col">Prénom :</td>
<td width="36%" scope="col"><input name="prenom" id="prenom" type="text" size="25" class="inputbox" /></td>
<td height="22" scope="row">Nom :</td>
<td><input name="nom" type="text" size="25" class="inputbox" /></td>
</tr>
<tr>
<td height="22" scope="row">Téléphone :</td>
<td colspan="3"><input name="tel" type="text" size="20" class="inputbox" /></td>
</tr>
<tr>
<td height="22" scope="row" valign="top">Adresse :</td>
<td colspan="3"><textarea name="adresse" cols="40" rows="2" class="inputbox"></textarea></td>
</tr>
<tr>
<td height="22" scope="row" colspan="4">
<input name="nompays" type="hidden" value="<?php echo $pays;?>" />
<input name="nomville" type="hidden" value="<?php echo $ville;?>" />
<input name="prixu" type="hidden" value="<?php echo $prixu;?>" />
<input name="comm" type="hidden" value="<?php echo $comm;?>" />
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset><legend class="mainlevel-main" id="active_menu-main"><strong>Informations sur l'article</strong></legend>
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="20%" height="22" scope="col">URL de l'article :</td>
<td width="80%" scope="col"><input name="url" type="text" size="32" class="inputbox" value="http://" /> (<span class="Style2">Veuillez copier et coller le lien internet de l'article</span>)</td>
</tr>
<tr>
<td height="22" scope="row">Article :</td>
<td><input name="catnom" type="text" size="32" class="inputbox" readonly="true" value="<?php echo $nom_art;?>" />
Quantité : <input name="quantite" type="text" size="10" class="inputbox" readonly="true" value="<?php echo $qte;?>" />
</td>
</tr>
<tr>
<td height="22" scope="row">Marque :</td>
<td><input name="marque" type="text" size="32" class="inputbox" /></td>
</tr>
<tr>
<td height="22" scope="row" valign="top">Précisions :</td>
<td><textarea name="detail" cols="50" rows="2" class="inputbox"></textarea></td>
</tr>
<tr>
<td height="22" scope="row">Prix PromoWeb :</td>
<td><input name="prixpw" type="text" size="32" class="inputbox" readonly="true" value="<?php echo $prixpw;?>" /> F CFA</td>
</tr>
<tr>
<td height="22" scope="row">Montant avance :</td>
<td><input name="avance" type="text" size="20" class="inputbox" readonly="true" value="<?php echo $mavance;?>" /> F CFA</td>
</tr>
</table>
</fieldset>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="43%" height="22" scope="col"> </td>
<td scope="col" align="center" colspan="2"><span class="Style4">Faite un choix définitif de destination</span></td>
</tr>
<tr>
<td scope="row"> </td>
<td width="13%" scope="row"> </td>
<td width="44%" align="left">
<input name="choix" type="radio" class="inputbox" onfocus="Javascript: document.simulateur.pt.value=<?php echo $prixpw1;?>;" value="ch1"/>
<label> Livraison à <?php echo"".$ville;?></label>
</td>
</tr>
<tr>
<td height="25" scope="row"> </td>
<td scope="row"> </td>
<td align="left">
<input name="choix" type="radio" value="ch2" class="inputbox" onfocus="Javascript: document.simulateur.pt.value=<?php echo $prixpw;?>;" />
<label> Livraison à <?php echo"".$ptchute;?></label>
</td>
</tr>
<tr>
<td height="37" scope="row"> </td>
<td scope="row"> </td>
<td align="left"> Au prix de: <input name="pt" size="10" type="text" value="<?php echo"".$prixpw;?>" class="inputbox" disabled="disabled" /> F CFA
</td>
</tr>
</table><br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="69%" scope="col"> </td>
<td width="31%" align="center" scope="col"><input name="valider" type="submit" value="Valider et commander l'article" class="button" /></td>
</tr>
</table>
</form>
</body>
</html>
fichier pour la requete d'ajax //RepPhpAjax.php
<?php
// script PHP interrogation Base de donnees pour reponse a la requette AJAX
// Connexion a la base de donnees
include('includes/mysql_connect.php');
@$email=addslashes($_POST["email"]);
//
$QuestionBase = "SELECT * FROM pw_client WHERE email='".@$_POST["val_sel"]."' AND codecl='".@$_POST["val_sel1"]."'" ;
//$QuestionBase = "SELECT * FROM pw_client WHERE ID='2'" ;
$res=mysql_query($QuestionBase) or die (mysql_error());
if(mysql_num_rows($res)!=0)
{
$data=mysql_fetch_array($res);
// construction de la liste deroulante
//$aff[0]="kdjkdfj";
/*$aff[0]="".$data['codecl'];
$aff[1]="/".$data['nomcl'];
$aff[2]="/".$data['prenomcl'];
$aff[3]="/".$data['email'];
$aff[4]="/".$data['telephone'];
for($i=0;$i<5;$i++)
{
echo $aff[$i];
}*/
$aff=="";
$aff=$aff."".$data['email']."/".$data['nomcl']."/".$data['prenomcl']."/".$data['telephone']."/".$data['codecl'];
// envoi reponse Php a Ajax
echo $aff;
}
else
{
$aff=="";
$aff=$aff."Votre email ou password n'est pas valide";
echo $aff;
}
// envoi reponse Php a Ajax
?> |
Partager