Closed Thread Icon

Preserved Topic: Need help (remember...I know nuting...nuting) - Javascript (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=17817" title="Pages that link to Preserved Topic: Need help (remember...I know nuting...nuting) - Javascript (Page 1 of 1)" rel="nofollow" >Preserved Topic: Need help (remember...I know nuting...nuting) - Javascript <span class="small">(Page 1 of 1)</span>\

 
Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 08-03-2000 15:24

I really do need help with a Javascript thing though. I actually want help on ALL of this. I have ot write a piece of Javascript code that, when a submit button on a form is clicked, it takes the value of a text field, compares it to a word already contained in javascript as a variable, and if it is right, redirects to one page, and if it is wrong, redirects to another page, and then sends me an email containing the ip address of the user who entered the wrong word, the time and date, and the word they entered. Please, keep it simple, and explain everything.




What's mine is mine, and what's yours is mine to - First Rule of a Dictatorship

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-03-2000 19:07

Hmm.. Here is the thing. You can do parts of this with JS (the check and the redirect if the answer is correct) but you are going to need a CGI to send the mail and redirect. I think your best bet is simply doing this all via cgi. Especially if this is some sort of password or something which requires some sort of security.

Does anyone know is there a way to get the IP address using JS? I don't know if that's possible. But I'm pretty sure you can get it via CGI Hmm. lemme check my perl scripts and see if I have something appropriate.

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 08-04-2000 04:02

Stuff the email then...this is just for a project for school. I do need to know how to check the password through a form though and redirect to a different page according to if it's right or wrong.




What's mine is mine, and what's yours is mine to - First Rule of a Dictatorship

ocb
Bipolar (III) Inmate

From: Dublin, Ireland
Insane since: Jun 2000

posted posted 08-04-2000 15:40

Actually, you can also do the redirect through javascript i.e.

window.location="http://??????.com"

I think HTMLGoodies.com has a password protect script somewhere you can look at. It's a good site to start learning Javascript.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-04-2000 22:04

Ok Skarjj, here ya go. Again remember this isn't the most secure script (anyone can view the HTML and see the password) but here you go:
<html>
<SCRIPT language="Javascript">
// this is where you change the password.
pw = 'yourpassword';

function checkpass(passform){
// assigns the submitted value to 'passwd' variable
passwd = passform.pass.value;
// checks the password and see's if it is correct if so redirects the user

if (passwd == pw){
// change the URL here to where you want the user to go if the password is correct. location.href="http://www.bitdamaged.com";
}
// wrong pw then it kicks the user over here
else {
location.href="http://www.gurusnetwork.com";
}
// this just makes sure the form doesn't try to go anywhere
return false
}
</script>
<style type="text/css">
body {font-size:10px; color:#FFDA4D; font-family: verdana;}
</style>
</head>
<body bgcolor="#024563">
<FORM onSubmit="return checkpass(this)">
Enter Password:<br>
<INPUT type="password" name="pass">
<p>
<INPUT type="submit" value="enter" >
</form>
</body>
</html>

[This message has been edited by bitdamaged (edited 04-08-2000).]

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 08-05-2000 01:27

Bitdamaged...thankyouthankyouthankyouthankyou
thankyouthankyouthankyouthankyouthankyouthankyou
thankyouthankyouthankyouthankyouthankyouthankyou
thankyouthankyouthankyouthankyouthankyouthankyou
thankyouthankyouthankyouthankyouthankyouthankyou
thankyouthankyouthankyouthankyouthankyouthankyou
thankyouthankyouthankyouthankyouthankyouthankyou
YOU ARE MY SAVIOUR!!! My script was very similar to that, except I didn't kow how to stop the form from going anywhere...and I couldn't get it to run the check_pass function. Again...THANKYOU!!!!!!




What's mine is mine, and what's yours is mine to - First Rule of a Dictatorship

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 08-08-2000 01:46

Does anyone know a way that I can encrypt the password using JavaScript? It probably can't be done, and I wouldn't remember the script if it could, but please, if it can be done, plase tell me.




What's mine is mine, and what's yours is mine to - First Rule of a Dictatorship

« BackwardsOnwards »

Show Forum Drop Down Menu