Captcha

Gestart doorErik15 reacties84 weergaven

16 berichten · pagina 1 van 2

Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,
Ik heb een captcha gemaakt, nu weergeeft hij em. Maar ik zie alleen geen code confusedHet script:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// De header[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Content-type: image/png[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// De captcha maken[/COLOR]
[COLOR= #0000BB]$img[/COLOR] [COLOR= #007700]=[/COLOR] imagecreate[COLOR= #007700]([/COLOR][COLOR= #0000BB]200[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]100[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// De achtergrond kleur instellen[/COLOR]
[COLOR= #0000BB]$bg[/COLOR] [COLOR= #007700]=[/COLOR] imagecolorallocate[COLOR= #007700]([/COLOR][COLOR= #0000BB]$img[/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= #FF8000]// De tekst kleur instellen[/COLOR]
[COLOR= #0000BB]$color[/COLOR] [COLOR= #007700]=[/COLOR] imagecolorallocate[COLOR= #007700]([/COLOR][COLOR= #0000BB]$img[/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= #FF8000]// Het lettertype instellen[/COLOR]
[COLOR= #0000BB]$font[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]fonts/DIEDIEDI.ttf[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// De tekst grootte instellen[/COLOR]
[COLOR= #0000BB]$size[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]10[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// De code genereren[/COLOR]
[COLOR= #0000BB]$code[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]100[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// De captcha tekst maken[/COLOR]
imagettftext[COLOR= #007700]([/COLOR][COLOR= #0000BB]$img[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$size[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$color[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$font[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$code[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// De captcha weergeven[/COLOR]
imagepng[COLOR= #007700]([/COLOR][COLOR= #0000BB]$img[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]// De captcha vernietigen[/COLOR]
imagedestroy[COLOR= #007700]([/COLOR][COLOR= #0000BB]$img[/COLOR][COLOR= #007700]);[/COLOR]
?>
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Staat ie ergens online ofzo?
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, op mijn xampp server, maar ik kan geen porten forwarden...
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Kun je dan even fonts/DIEDIEDI.ttf ergens uploaden?
0
Miel

Lid

Berichten
4.462
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Je font staat niet online?confused
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jawel..
0
Miel

Lid

Berichten
4.462
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hier niet hoor..confusedGeef url eens dan.yummie
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Klik
0
Miel

Lid

Berichten
4.462
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoofdletter gevoelige extensie.
0
Berichten
2.950
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wat anubisfan wil zeggen is dat je .TTF moet doen en .ttf
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat heb ik nu dus.. biggrin
0
Berichten
1.160
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Quote:
// De achtergrond kleur instellen
$bg = imagecolorallocate($img, 255, 255, 255);
// De tekst kleur instellen
$color = imagecolorallocate($img, 255, 255, 255);

Umm het is wit op wit.
Hoe wil je wit van wit aflezen?
Doe:
// De tekst kleur instellen
$color = imagecolorallocate($img, 0, 0, 0);[/quote]
0
Erik

Lid · Topicstarter

Berichten
7.109
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Damn.. emo Dadelijk eventjes veranderen.
Edit: Werkt nog niet..
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Bij GD library werken de coordinaten precies andersom ofzo...
Je schrijft dus wel doodleuk op (0, 0), maar das helemaal linksboven in de hoek. Als je dus op (0, 20) schrijft moet t goed gaan:
imagettftext($img, $size, 0, 0, 20, $color, $font, $code);
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