<php> if (isset($_REQUEST['action'])) {
if ($_REQUEST['name'] and $_REQUEST['email'])
{
list($userName, $mailDomain) = split("@", $_REQUEST['email']);
if (checkdnsrr($mailDomain, "MX"))
{
// Email valid et champ rempli :
print "<div class=\"noteclassic\"> Merci ".
$_REQUEST['name'].
" de ta participation.</div>\n\n <br /> <p> </p>";
$sSql = "INSERT INTO pronostics (name, email, sexe, comment, date, ip) VALUES (
'".SQLite3::escapeString($_REQUEST['name'])."',
'".SQLite3::escapeString($_REQUEST['email'])."',
'".SQLite3::escapeString($_REQUEST['sexe'])."',
'".SQLite3::escapeString($_REQUEST['comment'])."',
DATETIME('NOW'),
'".$_SERVER["REMOTE_ADDR"]."');";
// print($sSql);
$sFileDb = "/home/httpd/vhosts/laure-marc.ch/httpdocs/conf/concours.sql3";
$oDb = new SQLite3($sFileDb, 0666, $sErr);
if ($sErr) exit($sErr);
$oQuery = $oDb->query($sSql);
}
else
{
print "<div class=\"notewarning\"> Erreur, ton adresse email n'est pas valide ".
$_REQUEST['email'].
" merci de réessayer ou de nous envoyer un mail avec ton pari (nous@laure-marc.ch).</div>\n\n <br /> <p> </p>";
}
}
else
{
print "<div class=\"notewarning\"> Erreur, ton adresse email ou ton nom n'est pas rempli... <br /> merci de réessayer ou de nous envoyer un mail avec ton pari (nous@laure-marc.ch).</div>\n\n <br /> <p> </p>";
}
};
// DB queries $sFileDb = "/home/httpd/vhosts/laure-marc.ch/httpdocs/conf/concours.sql3"; $oDb = new SQLite3($sFileDb, 0666, $sErr); if ($sErr) exit($sErr);
$sSql = "SELECT count(*) FROM pronostics WHERE sexe='boy';"; $iBoy = $oDb->QuerySingle($sSql);
$sSql = "SELECT count(*) FROM pronostics WHERE sexe='girl';"; $iGirl = $oDb->QuerySingle($sSql);
$iBoyPourcent = round(($iBoy)/($iBoy+$iGirl)*100); $iGirlPourcent = round(($iGirl)/($iBoy+$iGirl)*100);
// Debug // echo ($iBoy + $iGirl) . " paris, soit $iBoy ($iBoyPourcent %) garçon, $iGirl ($iGirlPourcent %) fille \n";
echo '<table border="0">
<tr>
<td>
<img src="/lib/exe/fetch.php?media=bebe:boy.png">
</td>
<td>
<img src="/lib/exe/fetch.php?media=bebe:boy_color.png" width="'. $iBoyPourcent*3 .'" height="15">
<img src="/lib/exe/fetch.php?media=bebe:girl_color.png" width="'. $iGirlPourcent*3 .'" height="15">
<table width="100%">
<tr>
<td align="center" >garçon</td>
<td align="center">fille</td>
</tr>
<tr>
<td align="center">'.$iBoyPourcent.' % </td>
<td align="center">'.$iGirlPourcent.' % </td>
</tr>
</table>
</td>
<td>
<img src="/lib/exe/fetch.php?media=bebe:girl.png">
</td>
</tr> </table>'; </php>
Nous ne le savons pas, et vous ?
L'enjeux : l'apéro à une date à définir
Les gagnants profitent, les perdants se partagent la facture ….
Chaque membre de la famille peut jouer…
<html> <form method=“post” action=“#”> <input type=“hidden” name=“action” value=“vote”> <table> <tr> <td>Votre nom </td><td><input type='text' name=“name” size='50'> </td> </tr><tr> <td>Votre adresse email </td><td><input type='text' name=“email” size='50'> (n'est pas affichée)</td> <tr> <td>Votre pronostic</td><td> <select name=“sexe”>
<option value="girl" selected>Fille</option> <option value="boy"> Garçon </option>
</select> </td> </tr> <tr> <td> Remarques</td><td> <textarea name=“comment” cols=“50” rows=“5” id=“comment”></textarea></td> </tr> <tr> <td> </td><td> <input type=“submit” name=“submit” value=“Pariez !” /></td> </tr> </table> </form>
</html>