Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (19 June 2013 - 02:28 PM) Long Life To Asta New Era
@  agyat : (19 June 2013 - 01:58 PM) New Era Start At Asta Or Asta Start In New Era. :unsure:
@  yordan : (16 June 2013 - 05:41 PM) You're Welcome, Agyat!
@  agyat : (16 June 2013 - 07:38 AM) Thanks Yordan...
@  velma : (16 June 2013 - 12:06 AM) I Have Asked Opa To Check For A Backup.. He'll Let Me Know Soon :)
@  velma : (16 June 2013 - 12:05 AM) T_T It Seems That Someone Has Deleted That Topic Since I Found The Url Of The Topic But It Gives Me An Error
@  yordan : (15 June 2013 - 10:31 PM) @velma : It's A Tuto On How To Create A Login Program.
@  yordan : (15 June 2013 - 10:31 PM) Happy Birthday To Youuuuuu Agyat!
@  yordan : (15 June 2013 - 10:31 PM) Ba$
@  agyat : (15 June 2013 - 04:41 PM) :(
@  agyat : (15 June 2013 - 04:41 PM) Where The Hall I Were? 15Th Is Almost At End And No-One Wished Me "happy Birthday"!!!
@  velma : (14 June 2013 - 10:39 AM) Which Tutorial Is He Searching For?
@  velma : (14 June 2013 - 10:38 AM) Which Tutorial Is He Searching For?
@  yordan : (14 June 2013 - 07:47 AM) Ok, Have A Look Tomorrow.
@  yordan : (13 June 2013 - 03:19 PM) @velma, Can You Have A Look At Feelay's Problem? Seems That His Tutorial Is Not Searchable Today.
@  Feelay : (13 June 2013 - 08:11 AM) Oh, Haha
@  velma : (12 June 2013 - 05:39 PM) T_T Lately My Levels Of Procrastination..... **sigh**
@  velma : (12 June 2013 - 05:38 PM) I'll Do It Later
@  velma : (12 June 2013 - 05:38 PM) Procrastinators.. People Who Keep Saying "i'll Do This In A Bit"
@  Feelay : (12 June 2013 - 02:05 PM) Deal Punishments To What?

Replying to Image Verification Script


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

8ennett

Posted 12 August 2010 - 10:34 PM

Just realised I forgot to add the background images, however you can get a copy of them and a more detailed description of how to implement this script here http://www.astahost....t-1-t21786.html

Actually looking over the code above the whole thing has gone mental, the php tags have dissapeared etc. Just use the above link for a more up to date example.

HannahI

Posted 11 August 2010 - 10:23 PM

I didn't try this out, but I looked over the code and it looked like it would work. Great script. :)

8ennett

Posted 30 January 2010 - 11:10 PM

I use this script in most of my sites and find it to be a very reliable yet simple to implement at the same time. Ill run you through how the script works and also how to implement it.

First this is a seperate php file from which ever one you want to add the image verification to. This should remain as is and not be modified with any additional code.

randomImage.php
[codebox]// First start the session
session_start();

// Next we test if the form has been submitted or not
if (isset($_POST['Submit'])){

// Now we test to see if the users entered image code matches the real image
if (md5($_POST['ranval']) == $_SESSION['ranval']){

// If the entered code matches go to success page
header('Location: success.htm');
exit;
}
else {
// If the entered code was incorrect go to wrong code page
header('Location: wrong.htm');
exit;
}
}
<*form id="form1" name="form1" method="post" action="">
Enter Image Code:
<*input name="ranval" id="ranval" size="5" maxlength="5" type="text">
<*img src="randomImage.php" align="absmiddle" height="30" width="60">
<*input name="Submit" value="Submit" type="submit">[/codebox]


PLEASE REMEMBER TO REMOVE THE FOUR *'s FROM THE HTML TAGS, I HAD TO PUT THEM IN SO THEY WOULDN'T DISPLAY AS ACTUAL PAGE ELEMENTS!

Now this is an example php file which the image will appear on. If you copy and paste the code in to a new php file you can call it what ever you like. The first part is commented so you know what each section does in the code, this will only run IF the form has been submitted. The rest is the html. There is a form with a box for entering the code and an image, however note the source of the image is our randomImage.php and not a jpg or whatever.

When we call the randomImage.php file we are also writing the value of the images code to the session, however to ensure that nobody is monitoring the site traffic it is md5 encrypted before writing to the session.

Now when we enter the code and submit it, the code we entered is md5 encrypted and then compared to md5 encrypted session variable, if it matches you are redirected to the success page, if not then you are redirected to the incorrect page.

You can have any code run in the event of success or failure, such as a login page or so on, this is just a secure little add-on to prevent people from either brute forcing a password or bots from creating new accounts automatically.

Enjoy!

Review the complete topic (launches new window)