PDA

View Full Version : Enter Captcha First To Display/alert Anything.



amosngweien
12-20-2009, 05:25 PM
This Is What You Need
test.html < A Testing Page
captcha.js < A JS File To See What Happen When The User Type On The Textbox
random.js < A File That Show The Captcha Image

test.html Code:


<!-- Script Created By:Amosngweien -->
<!-- For More Scripts, Visit dynamicdrive.com -->
<html>
<head>
<script type="text/javascript" src="captcha.js"></script>
<script type="text/javascript" src="random.js"></script>
</head>
<body>
<form>
<b>For Security, Enter The Captcha</b>:<br />
<script type="text/javascript">random_imglink()</script>
<input type="text" id="text"/>
<button OnClick="javascript:Checkcaptcha()">Submit</button>

</form>
</body>
</html>

captcha.js


/*
Script Created By:Amosngweien
For More Scripts, Visit, Dynamicdrive.com
*/
function Checkcaptcha()
{
if (document.getElementById('text').value == '')
{
alert('Enter The Captcha!')
}
if (document.getElementById('text').value == 'Red Net Work')
{
(document.write("This Is Where You Want It To Display After Typing The Captcha"))
}
if (document.getElementById('text').value == 'Captcha')
{
(document.write("This Is Where You Want It To Display After Typing The Captcha"))
}
if (document.getElementById('text').value == 'Random')
{
(document.write("This Is Where You Want It To Display After Typing The Captcha"))
}
}

random.js


/*
Script Created By:Amosngweien
For More Scripts, Visit, Dynamicdrive.com
*/
function random_imglink()
{
var myimages=new Array()
myimages[1]="Red Net Work"
myimages[2]="Captcha"
myimages[3]="Random"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==1)
document.write('<img src="http://habboemotion.com/usable/text/?text='+myimages[ry]+'&folder=6&space=" border=0 />')
if (ry==2)
document.write('<img src="http://habboemotion.com/usable/text/?text='+myimages[ry]+'&folder=6&space=" border=0 />')
if (ry==3)
document.write('<img src="http://habboemotion.com/usable/text/?text='+myimages[ry]+'&folder=6&space=" border=0 />')
}

Okay, Now The Arrays In Random.js, Are Just Sample Captchas To Display
if you want 5 different captcha, Do


if (ry==1)
document.write('<img src="http://habboemotion.com/usable/text/?text='+myimages[ry]+'&folder=6&space=" border=0 />')

Until 5
Remember To Add 2 More Arrays in Random.js
Now, Lets Go Into captcha.js
Find The Text : This Is Where You Want It To Display After Typing The Captcha
For Example, You Want To Display:Hello
Then Change All The 'This Is Where You Want It To Display After Typing The Captcha' into 'Hello'
Now, Lets See The test.html now
This is how it works
Correct Captcha>Displays : e.g(Hello)
Wrong Captcha>Alert : Enter The Captcha!
if you are busy,
Cannot Do,
Put Your Code Here And I Will Generate It For You
like
Correct Captcha>Displays :
OR
Correct Captcha>Alert :
Wrong Captcha>Alert:
OR
Wrong Captcha>Displays:
How Many Different Arrays You Want?(Include No(1) Array Until The Amount You Want):
No(1):
...
And Post!
I Zipped The Stuff In As Demo
What Wasn't Used In This Tutorial
PHP Scripting
Mysql
PHPMYADMIN
I Used Javascript
Because
Php Tutorials All Are Secret Codes For Domains
Javascript Tutorials Works For All.
That's Why I Decided Javascript
But Also, Very HARD To Script Them.