logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Dreamweaver General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 07-08-2011, 08:14 PM   #1
drunkmafia
drunkmafia's Avatar
 
Join Date: Jun 2011
Posts: 17
Default Please help me!

HTML Code:
<script type="text/javascript">
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
</script>
</head>
var count = 2;
function validate() {
var un = document.myform.username.value;
var pw = document.myform.pword.value;
var valid = false;

var unArray = ["Username's go here","and more","and more"];
var pwArray = ["Password go here","and more","and more"];

for (var i=0; i <unArray.length; i++) {
if ((un == unArray[i]) && (pw == pwArray[i])) {
valid = true;
break;
}
}

if (valid) {
alert ("Login was successful");
window.location = "loggedin/new tab.html";
return false;
}

var t = " tries";
if (count == 1) {t = " try"}

if (count >= 1) {
alert ("Invalid username and/or password.  You have " + count + t + " left.");
document.myform.username.value = "";
document.myform.pword.value = "";
setTimeout("document.myform.username.focus()", 25);
setTimeout("document.myform.username.select()", 25);
count --;
}

else {
alert ("Still incorrect! You have no more tries left!");
document.myform.username.value = "No more tries allowed!";
document.myform.pword.value = "";
document.myform.username.disabled = true;
document.myform.pword.disabled = true;
return false;
}

}

</script>
<div id="apDiv1">
  <form name = "myform">
    <p>Username:
      <input type="text" name="username" />
    </p>
    <p>Password:
      <input type="password" name="pword" />
    </p>
    <p>
      <input type="button" value="Login" name="Submit" onclick= "validate()" />
    </p>
  </form>
OK here is the thing, this script it java script and therefore does not have a reg form and needs the user and pass info added in here
HTML Code:
var unArray = ["Username's go here","and more","and more"];
var pwArray = ["Password go here","and more","and more"];
It all works but what I want is to have the ability to have a reg form because when I made this I did not need one but know I do, How can I do this but still in java script!

Last edited by drunkmafia; 07-08-2011 at 08:19 PM..
drunkmafia is offline   Reply With Quote
Old 07-09-2011, 08:04 AM   #2
Corrosive
Corrosive's Avatar
 
Join Date: Feb 2008
Location: Bristol, England
Posts: 7,103
Default

You sure you wanna do reg in javascript? Seems like someone would only have to switch it off and bypass your security. Also easier to hack as it is client rather than server-side.
Corrosive is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:14 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com