[PHP] Captcha

Gestart doorErik15 reacties55 weergaven

16 berichten · pagina 1 van 2

Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi,
Ik heb dus een captcha, maar de check werkt helaas niet.

if($code != $_SESSION[captcha])
        {
            
            $fouten[] = De captcha code klopt niet.;
        
        }


Dat is de check.
Als jullie de code van captcha.php nodig hebben, moeten jullie het zeggen.
Helaas is er geen voorbeeld.
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
en $code = $_POST[code] ofzo ?
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Geweldig duidelijk ook. emo
Welke waarde heeft $code en welke heeft $_SESSION[captcha]?

Als je dat uitzoekt dan weet je denk ook meteen waar je fout zit. emo.
0
Bas

Lid

Berichten
1.081
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Opzich werkt ie zo denk ik maar ik maar ik denk dat een van die twee waardes niks is
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
LPHGIS
Aanmelden
De volgende fout is opgetreden:
De captcha code klopt niet.
Ga terug
Dat is het enige wat ie weergeeft.
$_SESSION[code] doet ie niet..
Dus de sessie is leeg..
De captcha code:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Content-type: image/png"[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$im[/COLOR] [COLOR= #007700]=[/COLOR] imagecreate[COLOR= #007700]([/COLOR][COLOR= #0000BB]150[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]30[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$wit[/COLOR] [COLOR= #007700]=[/COLOR] imagecolorallocate[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]255[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]255[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]255[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$tekens[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]5[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]7[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]<=[/COLOR] [COLOR= #0000BB]$tekens[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++)
{[/COLOR]
    
    [COLOR= #0000BB]$code[/COLOR] [COLOR= #007700].=[/COLOR] [COLOR= #0000BB]$chr[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/chr"]chr[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]65[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]90[/COLOR][COLOR= #007700]));[/COLOR]
    imagettftext[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]12[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700](-[/COLOR][COLOR= #0000BB]30[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]30[/COLOR][COLOR= #007700]), ([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]*[/COLOR] [COLOR= #0000BB]20[/COLOR][COLOR= #007700]),[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]13[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]30[/COLOR][COLOR= #007700]),[/COLOR] imagecolorallocate[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]200[/COLOR][COLOR= #007700]),[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]200[/COLOR][COLOR= #007700]),[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]200[/COLOR][COLOR= #007700])),[/COLOR] [COLOR= #DD0000]fonts/verdana.ttf[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$chr[/COLOR][COLOR= #007700]);

}[/COLOR]

[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$code[/COLOR][COLOR= #007700];[/COLOR]

imagepng[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700]);[/COLOR]
imagedestroy[COLOR= #007700]([/COLOR][COLOR= #0000BB]$im[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Baseldekker:
Opzich werkt ie zo denk ik maar ik maar ik denk dat een van die twee waardes niks is
Een van die waardes is wel fout, anders zou hij gewoon werken..

@ Erik: session_start() ?
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Staat in mn core.php
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Ja, maar daar heb je weinig aan als je captcha.php aanroept.
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Moet je captcha.php includen?
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Nee, je hebt toch
Afbeelding
neem ik aan?

Dan moet je in captcha.php session_start() doen als je een sessie start.

t Is net als met een auto, als je benzine op is gooi je ook geen benzine in de tank van je buurman en zegt dan "ja, die benzine zit in de auto van de buren, das toch ook goed?". emo
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb nu session_start() in captcha.php
Maar nu werkt het nog niet..
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
$_SESSION[code] blijft leeg?

Dan heb je of gewoon geen session_start(), of je set hem niet goed, of je maakt hem ergens leeg, een van die drie.
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wel grappig dat je zon gedownload gebruikt en hem verneukt emo
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nu heb ik de originele, werkt hij nog niet.. confused
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
debug eens dan
echo die troep

editjeeeh:

in je script gebruik je $_SESSION[captcha] en in je captcha.php $_SESSION[code]
failure
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren