Jump to content

captcha test


SFB

Recommended Posts

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

No, no, no, you got it all wrong! It's "characters", not "charictors"!The code looks fine though, what's it doing? Or not doing?Also, in ConTEXT, go to Options -> Environment Options, and check the first option on top. It will backup files before you save them, so you can check in the backup directory if you accidentally save over something.

Link to comment
Share on other sites

OK, it looks like it is outputting the string right now. So at least you have that going for you. Which is nice.You can try just dumping the different variables to make sure that things are happening like you expect. Try doing var_dump($im), but it might only say something like "Object" or "Resource". But you can do var_dump($font), var_dump($size) etc.Try using imagecreatetruecolor instead of imagecreate.

Link to comment
Share on other sites

You've got the right idea, but you need to move the array statements out of the loop, you are re-creating the array each time so they each end up with only 1 element, which happens to be element 6, which you don't even use since you stop at 5. Also, since you are going from 0 to 5 you want $i < 6 instead of $i <= 6, there's just not a reason to make the next one even though it won't mess anything up.

$font = array();$size = array();$tilt = array();$y_cord = array();for ($i = 0; $i < 6; $i++) {  $font[$i] = 'font'.rand(1,6);  $size[$i] = rand(25,30);  $tilt[$i] = rand(0,18);  $y_cord[$i] = rand(20,30);}

Link to comment
Share on other sites

SFB, you can not have errors on because it could show your scource to a hacker how puts in false information and trys to get access to your source... to help prevent this from happening Apache has permantly blocked access to letting php.ini turn on errors... even though you have posted your source here...I would try running the code on xampp or get a php account on Mitch's server...---- ---I never write over files... I just create a new folder and stick it in there... I have 2 desktop folders and my desktop... 3 server folders on my computer with folders in them for each version of my site, as well as 2 folders on my server that have backup copies...

Link to comment
Share on other sites

You'll probably want to do the background first, when you create the image. Make yourself a series of backgrounds that are the same size, and then when you create your image you can create it from one of those backgrounds and put the text over it.Nice clock, btw.

Link to comment
Share on other sites

You can do random colors if you want. If your text is white, then you can do random values for R, G, and B between 0-128 to keep the background fairly dark. Then you could also do random colors for the text between something like 192-255.

Link to comment
Share on other sites

One problem is the font with the outlined letters - it doesn't have any lowercase! I incorrectly entered several codes that appeared uppercase but were actually lowercase. You should probably switch that font.I would also switch out the comic sans or whatever font that is. Some letters like u, v, and w look identical in upper or lower. Get a list of fonts, print a character set for each one you want to use, and look over it to make sure the upper and lower are distinctly different. Fonts with serifs seem to do well there. Or, you can just make it all upper or lower.Also, some characters went off the image. There is a function to get the size of an image box, you can make sure it doesn't go off the border. Some letters were also overlapping eachother.There it is:http://www.php.net/manual/en/function.imagettfbbox.php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...