[Artichow] Image PNG en caractères ASCII suite à formulaire en PHP
Bonjour,
J'ai un soucis.
J'ai un fichier PHP dans lequel j'effectue à la fois l'affichage d'un formulaire et la vérification de celui-ci :
Code:
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
|
<?php
if(empty($_POST['submit_subscription'])) {
?>
<table height='100%' width='100%'>
<tr>
<td>
<div id='formulaire'>
<center><font size='5'><b>Enregistrement d'un nouvel utilisateur</b></font></center>
<br />
<br />
<form method='post' action='<?php echo $_SERVER['PHP_SELF']; ?>'>
<table>
<tr>
<td align='right'>Login :</td><td><input type='text' size='30' name='login' /></td>
</tr>
<tr>
<td align='right'>Mot de passe :</td><td><input type='password' size='30' name='password' /></td>
</tr>
<tr>
<td align='right'>Confirmez votre mot de passe :</td><td><input type='password' size='30' name='password_check' /></td>
</tr>
<tr>
<td align='right'>Adresse email :</td><td><input type='text' size='30' name='email' /></td>
</tr>
<tr>
<td align='right'>Confirmez votre adresse email :</td><td><input type='text' size='30' name='email_check' /></td>
</tr>
<tr>
<td align='right'>Nom :</td><td><input type='text' size='30' name='lastname' /></td>
</tr>
<tr>
<td align='right'>Prénom :</td><td><input type='text' size='30' name='firstname' /></td>
</tr>
<tr>
<td align='right'>Date de naissance :</td>
<td>
<select name='selection_day'>
<?php for($d=31 ; $d>0 ; $d--) echo "<option value='".$d."'>".$d."</option>"; ?>
</select>
<select name='selection_month'>
<?php for($m=1 ; $m<13 ; $m++) echo "<option value='".$m."'>".$m."</option>"; ?>
</select>
<select name='selection_year'>
<?php for($y=date('Y')-1 ; $y>1899 ; $y--) echo "<option value='".$y."'>".$y."</option>"; ?>
</select>
</td>
</tr>
<tr>
<td align='right'><img src="includes/anti_spam.php" style="vertical-align: middle" alt="AntiSpam" /></td>
<td><input type="text" size='30' name="spam" /></td>
</tr>
</table>
<br />
<center><input type='submit' name='submit_subscription' value="S'inscrire" /> <input type='reset' value='Effacer' /></center>
</form>
</div>
</td>
</tr>
</table>
<?php
}
elseif(!empty($_POST['submit_subscription'])) {
require_once("Artichow/AntiSpam.class.php");
$object = new AntiSpam();
if($object->check('captcha', $_POST['spam'])) {
// Requêtes MySQL...
} else header("Location: subscription.php");
}
?> |
Et j'ai aussi mon anti_spam.php :
Code:
1 2 3 4 5 6 7 8 9 10
|
<?php
require_once("../Artichow/AntiSpam.class.php");
$object = new AntiSpam();
$object->setRand(8);
$object->save('captcha');
$object->draw();
?> |
Mais quand je le valide, j'ai une image PNG qui s'affiche en caractères ASCII...
Comme vous pouvez le voir dans le code, il y a un captcha généré avec Artichow et celui-ci s'affiche très bien !
Alors pourquoi cette image au lieu de ma phrase de confirmation d'inscription ??
PS : Visiblement c'est cette ligne qui pose problème :
Code:
if($object->check('captcha', $_POST['spam'])) {
Et lorsque je teste en local sur Firefox, ça donne ce message : "L'image “http://localhost/subscription.php” ne peut être affichée car elle contient des erreurs."
Merci d'avance.
Christophe