Script CAPTCHA Images

Scipt complet

<?php
session_start();//Ne pas oublier
define('SITE_NOM', 'mon-site.com');//Nom de votre site
define('MAIL_CONTACT', 'admin@mon-site.com');//Adresse mail de votre site         
?>
 <a id="contact-site"></a>
 <h1>Test alpha Captcha Images :</h1>
 <br />
<?php
 function get_ip() {
 if (isset($_SERVER['HTTP_CLIENT_IP'])) {
 return $_SERVER['HTTP_CLIENT_IP'];
 }
 elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
 return $_SERVER['HTTP_X_FORWARDED_FOR'];
 }
 else {
 return (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '');
 }
 }
 $reel = get_ip();
?>
<?php                                                                                                 
 if (isset($_POST['envoie_alpha_captcha']))                                                    
 {
 $name;$email;$subject;$comments;
 if(isset($_POST['name'])){
 $name=$_POST['name'];
 }        
 if(isset($_POST['email'])){
 $email=$_POST['email'];
 }
 if(isset($_POST['subject'])){
 $subject=$_POST['subject'];
 }        
 if(isset($_POST['comments'])){
 $comments = stripslashes($_POST['comments']);
 }        
            
 if (md5(strtoupper($_POST['captcha'])) != $_SESSION['captcha']){
 $erreur_captcha = "Le code de vérification (captcha) est erroné<br />"; 
 }
 if (md5(strtoupper($_POST['captcha'])) == $_SESSION['captcha']) { 
 $headerMail = "MIME-Version: 1.0\r\n";
 $headerMail .= "Content-type: text/html; charset=UTF-8\r\n";
 $headerMail .='Content-Transfer-Encoding: 8bit'."\r\n";
 $headerMail.="From: $email \r\n";//pour répondre au message
 $mailSujet = "Contact depuis  ".SITE_NOM." par: " . $name;
 $mailMessage = "
 <br />
 Nom : ".$name."<br />
 Adresse mail du contact : ".$email."<br />
 IP : ".$reel."<br /><br />
 Message :<br />".nl2br($comments)."<br />
 ";
 mail(MAIL_CONTACT,$mailSujet,$mailMessage,$headerMail);
                   
 $Message_retour = "Votre message a bien été envoyé.";      
?>
 <br />
 <div id="message"><span style="color:#ff0000;"><?php echo $Message_retour ?></span></div>
 <br />                                                   
 <form method="post" action="#contact-site" id="comment_form">                                        
 <label for="name" style="width: 50%;"><span style="color:#ff0000;">*</span> Nom</label>
 <input name="name" id="name" type="text" style="margin-left:80px;width: 30%;" class="" value="<?php echo $name; ?>" required="">
 <br /> <br />
 <label for="email" style="width: 50%;"><span style="color:#ff0000;">*</span> Adresse e-mail</label>
 <input name="email" id="email" type="email" style="margin-left:4px;width: 30%;" class="" value="<?php echo $email; ?>" required="">
 <br /> <br />
 <label for="subject" style="width: 50%;"><span style="color:#ff0000;">*</span> Sujet</label>
 <input name="subject" id="subject" type="text" style="margin-left:80px;width: 30%;" class="" value="<?php echo $subject; ?>" required="">
 <br /> <br />                                                                                                          
 <label for="comments" style="width: 50%;"><span style="color:#ff0000;">*</span> Message</label>
 <?php if(get_magic_quotes_gpc()) {$comments = stripslashes($comments);} ?>
 <textarea name="comments" id="comments" rows="4" style="margin-left:52px;width: 30%;height: 80px !important;" class="" required=""><?php echo $comments; ?></textarea>
 <br /> <br />
 <img src="/alpha_captcha/captcha.php" alt="Captcha" id="captcha" />    
 <img src="/alpha_captcha/actualiser.png" alt="actualiser" title="Recharger l'image du captcha si vous ne parvenez pas à lire le code." style="cursor:pointer;position:relative;top:-7px;" onclick="document.images.captcha.src='/alpha_captcha/captcha.php?id='+Math.round(Math.random(0)*1000)"  />
 <br /> <br />
 <label for="captcha" style="width: 50%;"><span style="color:#ff0000;">*</span> Ecrire ici le texte affiché sur l'image</label>
 <br /> <br />
 <input name="captcha" id="captcha" type="text" style="margin-left:4px;width: 30%;" class="" placeholder="Code de vérification" value=""" required="">
 <br /> <br />                                        
                                        
 <input type="submit" id="submit" name="envoie_alpha_captcha" class="btn btn-perso w-100" value="Envoyer">
 </form>
<?php
}
 else {  
?>
 <div id="message"><span style="color:#ff0000;"><?php echo $erreur_captcha ?></span></div>
 <br />                                                   
 <form method="post" action="#contact-site" id="comment_form">                                        
 <label for="name" style="width: 50%;"><span style="color:#ff0000;">*</span> Nom</label>
 <input name="name" id="name" type="text" style="margin-left:80px;width: 30%;" class="" value="<?php echo $name; ?>" required="">
 <br /> <br />
 <label for="email" style="width: 50%;"><span style="color:#ff0000;">*</span> Adresse e-mail</label>
 <input name="email" id="email" type="email" style="margin-left:4px;width: 30%;" class="" value="<?php echo $email; ?>" required="">
 <br /> <br />
 <label for="subject" style="width: 50%;"><span style="color:#ff0000;">*</span> Sujet</label>
 <input name="subject" id="subject" type="text" style="margin-left:80px;width: 30%;" class="" value="<?php echo $subject; ?>" required="">
 <br /> <br />                                                                                                          
 <label for="comments" style="width: 50%;"><span style="color:#ff0000;">*</span> Message</label>
 <?php if(get_magic_quotes_gpc()) {$comments = stripslashes($comments);} ?>
 <textarea name="comments" id="comments" rows="4" style="margin-left:52px;width: 30%;height: 80px !important;" class="" required=""><?php echo $comments; ?></textarea>
 <br /> <br />
 <img src="/alpha_captcha/captcha.php" alt="Captcha" id="captcha" />    
 <img src="/alpha_captcha/actualiser.png" alt="actualiser" title="Recharger l'image du captcha si vous ne parvenez pas à lire le code." style="cursor:pointer;position:relative;top:-7px;" onclick="document.images.captcha.src='/alpha_captcha/captcha.php?id='+Math.round(Math.random(0)*1000)"  />
 <br /> <br />
 <label for="captcha" style="width: 50%;"><span style="color:#ff0000;">*</span> Ecrire ici le texte affiché sur l'image</label>
 <br /> <br />
 <input name="captcha" id="captcha" type="text" style="margin-left:4px;width: 30%;" class="" placeholder="Code de vérification" value=""" required="">
 <br /> <br />                                        
                                        
 <input type="submit" id="submit" name="envoie_alpha_captcha" class="btn btn-perso w-100" value="Envoyer">
 </form>
<?php
 }
}
 else {      
?>
 <form method="post" action="#contact-site" id="comment_form">                                        
 <label for="name" style="width: 50%;"><span style="color:#ff0000;">*</span> Nom</label>
 <input name="name" id="name" type="text" style="margin-left:80px;width: 30%;" class="" value="<?php echo $name; ?>" required="">
 <br /> <br />
 <label for="email" style="width: 50%;"><span style="color:#ff0000;">*</span> Adresse e-mail</label>
 <input name="email" id="email" type="email" style="margin-left:4px;width: 30%;" class="" value="<?php echo $email; ?>" required="">
 <br /> <br />
 <label for="subject" style="width: 50%;"><span style="color:#ff0000;">*</span> Sujet</label>
 <input name="subject" id="subject" type="text" style="margin-left:80px;width: 30%;" class="" value="<?php echo $subject; ?>" required="">
 <br /> <br />                                                                                                          
 <label for="comments" style="width: 50%;"><span style="color:#ff0000;">*</span> Message</label>
 <?php if(get_magic_quotes_gpc()) {$comments = stripslashes($comments);} ?>
 <textarea name="comments" id="comments" rows="4" style="margin-left:52px;width: 30%;height: 80px !important;" class="" required=""><?php echo $comments; ?></textarea>
 <br /> <br />
 <img src="/alpha_captcha/captcha.php" alt="Captcha" id="captcha" />    
 <img src="/alpha_captcha/actualiser.png" alt="actualiser" title="Recharger l'image du captcha si vous ne parvenez pas à lire le code." style="cursor:pointer;position:relative;top:-7px;" onclick="document.images.captcha.src='/alpha_captcha/captcha.php?id='+Math.round(Math.random(0)*1000)"  />
 <br /> <br />
 <label for="captcha" style="width: 50%;"><span style="color:#ff0000;">*</span> Ecrire ici le texte affiché sur l'image</label>
 <br /> <br />
 <input name="captcha" id="captcha" type="text" style="margin-left:4px;width: 30%;" class="" placeholder="Code de vérification" value=""" required="">
 <br /> <br />                                        
                                        
 <input type="submit" id="submit" name="envoie_alpha_captcha" class="btn btn-perso w-100" value="Envoyer">
 </form>
<?php
 }   
?> 
  <br />
 <br />