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
| <style type="text/css">
<!--
body {
background-image: url(images/fond_home.gif);
background-repeat: repeat;
}
-->
</style>
</head>
<?php
$default['txtNom'] = isset($_POST['txtNom'])?$_POST['txtNom']:'';
;
if (isset($_POST['cmdEnvoyer'])) {
if (!isset($_REQUEST['chkRegl']))
{
print ("<div style='color:red'>Veuillez accepter le règlement pour continuer</div>");
} else
{
require_once('TestFormulaire_fr.php');
// Register the subclasses to use
$v['er'] = new ValidateRequired('Nom', $_POST['txtNom']);
$v['s'] = new ValidateRequired('Prénom', $_POST['txtPrenom']);
$v['e'] = new ValidateEmail($_POST['txtMail']);
$v['u'] = new ValidateNumClient($_POST['txtNumCli']);
$v['t'] = new ValidateRequired('Adresse', $_POST['txtAdresse']);
$v['v'] = new ValidateRequired('Code Postal', $_POST['txtCP']);
$v['w'] = new ValidateRequired('Ville', $_POST['txtVille']);
$errorMsg = '';
$errorNumCli = '';
$errorAdresse = '';
// Perform each validation
foreach($v as $validator)
{
if (!$validator->isValid())
{
while ($error=$validator->getError())
{
if ($error =='N° Client non valide')
{
$errorNumCli.="<li>".$error."</li>\n";
}
else if (($error =='Adresse doit être renseigné !') || ($error =='Code Postal doit être renseigné !')|| ($error=='Ville doit être renseigné !'))
{
$errorAdresse.="<li>".$error."</li>\n";
} else
{
$errorMsg.="<li>".$error."</li>\n";
}
}
}
}
if ($errorMsg != '')
{
print ("<div style='color:red'>Les erreurs suivantes se sont produites:\n<ul>".$errorMsg."</ul></div>");
}
else if (($errorNumCli != '') && (($errorAdresse != '') || ($errorCP != '') || ($errorVille != '')))
{
print ("<div style='color:red'>Veuillez remplir votre adresse complète ou votre numéro client</div>");
}
else
{
$Nom = $_POST['txtNom'];
$base = mysql_connect ('sql1', '********', '*****');
mysql_select_db ('*******', $base) ;
$sql_Select = 'Select * from concours_tomtom where tomtom_Mail = "'.$_POST['txtMail'].'"';
$result = mysql_query ($sql_Select) or die ('Erreur SQL !'.$sql_Select.'<br />'.mysql_error());
if (mysql_num_rows($result) == "")
{
$sql_Select = 'Select * from concours_tomtom where tomtom_NumCli = "'.$_POST['txtNumCli'].'"';
$result = mysql_query ($sql_Select) or die ('Erreur SQL !'.$sql_Select.'<br />'.mysql_error());
if (mysql_num_rows($result) == "")
{
// lancement de la requete
$sql = 'INSERT INTO concours_tomtom VALUES ("", "'.$_POST['txtNom'].'", "'.$_POST['txtPrenom'].'", "'.$DateNaissance.'", "'. $_POST['txtMail'].'", "'.$_POST['txtNumCli'].'","'.$_POST['txtAdresse'].'","'.$CP.'","'.$_POST['txtVille'].'", "'.$Garage.'")';
// on insere le tuple (mysql_query) et au cas où, on écrira un petit message d'erreur si la requête ne se passe pas bien (or die)
mysql_query ($sql) or die ('Erreur SQL !'.$sql.'<br />'.mysql_error());
// on ferme la connexion à la base
mysql_close();
echo "<script language=\"JavaScript\" type=\"text/JavaScript\">
document.location = 'TomtomSuccess_fr.php'
</script>";
} else
{
echo "<script language=\"JavaScript\" type=\"text/JavaScript\">
document.location = 'TomtomError_fr.php'
</script>";
}}
} }
}
?>
<form name="Formulaire_Concours" action="<?php echo ($_SERVER['PHP_SELF']); ?>" method="post">
<table width="95%" border="0" align="center">
<tr>
<td height="51" colspan="6" align="center" valign="middle"><p><img src="images/TitreJeuNoel.gif" width="468" height="88" /></p></td>
<td width="159" rowspan="3"><img src="images/TomtomOne.gif" width="159" height="152" /></td>
</tr>
<tr>
<td height="0" colspan="6" rowspan="2"><p class="TextedePage"> </p> </td>
</tr>
<tr>
<td width="4" height="24"><p> </p>
</td>
</tr>
<tr>
<td width="1" align="left" valign="middle"> </td>
<td height="88" colspan="6" align="left" valign="middle"><span class="TextedePage"><img src="images/ParticipTomtom3.gif" alt="Pour participer" width="581" height="131" /></span></td>
</tr>
<tr>
<td height="42" align="center" valign="top"> </td>
<td width="300" align="center" valign="top" class="TextedePage"> </td>
<td width="450" align="center" valign="top"> </td>
<td width="118" height="42"> </td>
<td width="1" align="center" valign="middle"> </td>
<td colspan="2" align="center" valign="middle"> </td>
</tr>
<tr>
<td height="31" align="center" valign="top"> </td>
<td align="center" valign="top" class="TextedePage"><div align="left">
<label class="InfosTomtom">Nom :</label>
</div></td>
<td align="center" valign="top"><div align="left">
<input name="txtNom" type="text" id="txtNom" value="<?php echo $default['txtNom']; ?>" />
<span class="InfosTomtom">*</span></div></td>
<td height="31"> </td>
<td align="center" valign="middle"> </td>
<td colspan="2" align="center" valign="middle"> </td>
</tr>
<tr>
<td height="23" align="center" valign="top"> </td>
<td height="23" colspan="6" align="left" valign="top" class="TextedePage"><form id="form1" name="form1" method="post" action="">
<label>
<input name="chkRegl" type="checkbox" value="valeur"/>
</label>
<span class="InfosSites">En cochant cette case, j'accepte le règlement. Pour recevoir le règlement cliquez <a href="mailto:nicolas.giltaire@mannes.fr?subject=Demande de règlement&body=Merci de m'envoyer le règlement par mail">ici</a></span>
</form> </td>
</tr>
<tr>
<td height="35" align="center" valign="top"> </td>
<td colspan="2" align="left" valign="bottom" class="InfosSites">* Champs obligatoires </td>
<td height="35"> </td>
<td align="center" valign="middle"> </td>
<td colspan="2" align="center" valign="middle"><input name="cmdEnvoyer" type="submit" id="cmdEnvoyer" value="Envoyer" disable/>
</td>
</tr>
<tr>
<td align="left" valign="middle"> </td>
<td align="left" valign="middle"> </td>
<td align="left" valign="middle"> </td>
<td height="88"> </td>
<td align="center" valign="middle"> </td>
<td colspan="2" align="center" valign="middle"> </td>
</tr>
</table>
<p align="center"> </p>
<p align="center"> </p>
</form>
</body>
</html> |
Partager