How do i randomly display pictures

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

How do i randomly display pictures

Post by adsegzy »

I want to use pictures as my CAPTCHA on my form page., i have all the pictures i want in my picture folder. is it possible or how do i display a different picture every time my form page is refreshed or visited?

If it is not possible, kindly recommend wayout.


regards
User avatar
timWebUK
Forum Contributor
Posts: 239
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: How do i randomly display pictures

Post by timWebUK »

You don't want to do it through pictures, you want to create a background and randomly generate a string on top of it. This tutorial is quite good:

http://www.codewalkers.com/c/a/Miscella ... -with-PHP/
askbapi
Forum Newbie
Posts: 10
Joined: Fri Dec 04, 2009 11:24 pm
Location: India

Re: How do i randomly display pictures

Post by askbapi »

u can also use recaptcha, easy and fast.
sangoku
Forum Newbie
Posts: 10
Joined: Wed Dec 02, 2009 10:48 am

Re: How do i randomly display pictures

Post by sangoku »

timWebUK wrote:You don't want to do it through pictures, you want to create a background and randomly generate a string on top of it. This tutorial is quite good:

http://www.codewalkers.com/c/a/Miscella ... -with-PHP/
Why would you do that? then you could just let them pass.... :crazy:

the best way to do it if you want to do it old fashioned way is to make a table or hard write it into code mean the verification text and correlate it with the pictures them self. then when someone enters the seen text he you just have to clean his text and compare it with the referential one. That is fairly an easy way to do things, not to muhc code :drunk:

like make an :
array('image location' => text_of_the_image, .....);
then generate a random number put that in lets say $rand which gets a number which is in the range of the array. Then do something like this:

$link = $array[$rand]

//compare output the picture and store the text of the image in some value( :arrow: sesion? ) when the user tzpes it then just compare it XD pretty easy you could easy make aclass of it t0 XD
Post Reply