IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Captcha ne s'affiche pas


Sujet :

Langage PHP

  1. #1
    Membre régulier
    Homme Profil pro
    Inscrit en
    Décembre 2008
    Messages
    299
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Secteur : Distribution

    Informations forums :
    Inscription : Décembre 2008
    Messages : 299
    Points : 103
    Points
    103
    Par défaut Captcha ne s'affiche pas
    Bonjour,
    Je relance le sujet car je n'ai pas pu résoudre le problème.

    La librairie GD est bien active et à la bonne version

    J'ai un dossier polices (ttf) à la racine de mon site avec les différents polices de texte repris dans le code du captcha.

    J'ai essayé de voir d'ou cela pourrais provenir mais sans résultat

    Code du captcha
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    <?php
     
    session_start();
     
    header ("Content-type: image/png");
    $image = imagecreate(320, 100);
     
    $blanc = imagecolorallocate($image, 255, 255, 255);
    $noir = imagecolorallocate($image, 0, 0, 0);
    $gris = imagecolorallocate($image, 200,200,200);
    $jaune = imagecolorallocate($image, 255, 255, 0);
    $rouge = imagecolorallocate($image, 200, 39, 45);
    $vert = imagecolorallocate($image, 45, 255, 39);
    $cyan = imagecolorallocate($image, 0, 255, 255);
    $magenta = imagecolorallocate($image, 200, 0, 200);
    $orange = imagecolorallocate($image, 255, 160, 0);
    $bleu = imagecolorallocate($image, 60, 75, 200);
    $bleuclair = imagecolorallocate($image, 156, 227, 254);
    $vertf = imagecolorallocate($image, 20, 140, 17);
     
    /*$Anoir = imagecolorallocatealpha($image, 0, 0, 0, 80);
    $Ajaune = imagecolorallocatealpha($image, 255, 255, 0, 80);
    $Ablanc = imagecolorallocatealpha($image, 255, 255, 255, 80);
    $Arouge = imagecolorallocatealpha($image, 200, 39, 45, 80);
    $Avert = imagecolorallocatealpha($image, 45, 200, 39, 80);
    $Acyan = imagecolorallocatealpha($image, 0, 255, 255, 80);
    $Amagenta = imagecolorallocatealpha($image, 255, 0, 255, 80);
    $Aorange = imagecolorallocatealpha($image, 255, 128, 0, 80);
    $Ableu = imagecolorallocatealpha($image, 39, 45, 200, 80);
    $Ableuclair = imagecolorallocatealpha($image, 156, 227, 254, 80);
    
    $A2noir = imagecolorallocatealpha($image, 0, 0, 0, 25);
    $A2jaune = imagecolorallocatealpha($image, 255, 255, 0, 25);
    $A2blanc = imagecolorallocatealpha($image, 255, 255, 255, 25);
    $A2rouge = imagecolorallocatealpha($image, 200, 39, 45, 25);
    $A2vert = imagecolorallocatealpha($image, 45, 200, 39, 25);
    $A2cyan = imagecolorallocatealpha($image, 0, 255, 255, 25);
    $A2magenta = imagecolorallocatealpha($image, 255, 0, 255, 25);
    $A2orange = imagecolorallocatealpha($image, 255, 128, 0, 25);
    $A2bleu = imagecolorallocatealpha($image, 39, 45, 200, 25);
    $A2bleuclair = imagecolorallocatealpha($image, 156, 227, 254, 25);*/
     
    //Toutes les couleurs
    $colors = Array($vert, $noir, $jaune, $blanc, $rouge, $cyan, $magenta, $orange, $bleu, $bleuclair, $gris, $vertf);
    $Tcolors = count($colors);
     
    /*$colors2 = Array($Avert, $Anoir, $Ajaune, $Ablanc, $Arouge, $Acyan, $Amagenta, $Aorange, $Ableu, $Ableuclair);
    $Tcolors2 = count($colors2);
    $colors3 = Array($A2vert, $A2noir, $A2jaune, $A2blanc, $A2rouge, $A2cyan, $A2magenta, $A2orange, $A2bleu, $A2bleuclair);
    $Tcolors3 = count($colors3);*/
     
    //couleurs autorisées pour les caractères
    $Lcolors = Array($noir, $rouge, $magenta, $bleu, $vertf);
    $TLcolors = count($Lcolors);
     
    $polices = Array('GreatShadow','ConeriaScript','ConeriaScript_slanted');
    $Tpolices = count($polices);
     
    //définition des caractères autorisés.
    $carac = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $Tcarac = strlen($carac);
     
    //définition des lignes noires
    $nb_lignes = mt_rand(3,7);
    $i = 1;
    while($i<=$nb_lignes)
    {
    	ImageLine($image, mt_rand(0,40), mt_rand(0,100), mt_rand(280, 320), mt_rand(0,100), $noir);
    	$i++;
    }
     
    //définition des lignes colorées.
    $nb_lignes = mt_rand(3,7);
    $i = 1;
    while($i<=$nb_lignes)
    {
    	ImageLine($image, mt_rand(0,40), mt_rand(0,100), mt_rand(280,320), mt_rand(0,100), $colors[mt_rand(0,$Tcolors-1)]);
    	$i++;
    }
     
    //définition des ellipses
    $nb_ellipses = mt_rand(1,6);
    $i = 1;
    while($i<= $nb_ellipses)
    {
    	ImageEllipse($image, mt_rand(0,320), mt_rand(0,100), 25+mt_rand(0,15), 25+mt_rand(0,15), $colors[mt_rand(0,$Tcolors-1)]);
    	$i++;
    }
     
    //définition des triangles
    $nb_triangles = mt_rand(1,6);
    $i = 1;
    while($i<=$nb_triangles)
    {
    	$array = Array(mt_rand(0,300), mt_rand(0,100), mt_rand(0,300), mt_rand(0,100), mt_rand(0,300), mt_rand(0,100));
    	ImagePolygon($image, $array, 3, $colors[mt_rand(0,$Tcolors-1)]);
    	$i++;
    }
     
     
    $aupifcolor = $Lcolors[mt_rand(0,$TLcolors-1)]; //la couleur des caractères
    $ecart = 300/10+4; //écart entre les caractères
     
    $_SESSION['captcha'] = ''; //La voilà !! Enfin !!
     
    $i = 0;
    while($i <= 7)
    {
    	$lettre = $carac[mt_rand(0, $Tcarac-1)]; //choix de lettre
    	$_SESSION['captcha'] .= $lettre; //stockage
    	$taille = mt_rand(35,45); //taille
    	$angle = mt_rand(-35,35); //angle
    	$y = mt_rand(55, 60); //ordonnée
    	$police = $polices[mt_rand(0, $Tpolices-1)]; //police :p
     
    	imagettftext($image, $taille, $angle, $ecart*$i+15, $y, $aupifcolor, './/polices/'.$police.'.ttf', $lettre);
    	$i++;
    }
     
    imagepng($image); //On envoie et on prie :p
    ?>
    Au niveau de l'affichage voir pièce joint.



    Je vous remercie de votre aide car je suis bloqué pour l'avancement de mon projet.

    Runcafre91
    Images attachées Images attachées  

  2. #2
    Membre régulier
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2008
    Messages
    69
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2008
    Messages : 69
    Points : 94
    Points
    94
    Par défaut
    l'url de ton image pointe bien sur ton script au moins ?

Discussions similaires

  1. [Images] Image captcha ne s'affiche pas une fois sur le serveur
    Par yfchauer dans le forum Bibliothèques et frameworks
    Réponses: 0
    Dernier message: 15/09/2013, 15h16
  2. le captcha ne s'affiche pas
    Par mademoizel dans le forum Zend Framework
    Réponses: 3
    Dernier message: 17/12/2010, 11h15
  3. Le résultat de Print ne s'affiche pas...
    Par Red Bull dans le forum Langage
    Réponses: 9
    Dernier message: 15/06/2006, 18h56
  4. [MFC] Ces fenêtres qui ne s'affichent pas..
    Par Davide dans le forum MFC
    Réponses: 3
    Dernier message: 19/11/2003, 11h30

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo