JavaScript - Insecure Login Script That Does Not Redirect You With Successful Login
Hello everyone. I have a a html page that is used as a login page. I know it is not secure but this is just for learning purposes, I'm not using it for anything important.
My problem is that when I put in the correct login all that happens is the page just clears the text boxes as if you were starting over. I am trying to get it to go to register.html which is located in the same directory as the login page. Help with what I'm doing wrong would be greatly appreciated. Here is the code: Code: <html> <head> <title>Login Page</title> </head> <body> <script type = "text/javascript"> var count = 2; function validate() { var un = document.myform.username.value; var pw = document.myform.pword.value; var valid = false; var unArray = ["Philip", "George", "Sarah", "Michael"]; // as many as you like - no comma after final entry var pwArray = ["Password1", "Password2", "Password3", "Password4"]; // the corresponding passwords; 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 = "register.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> <form> <table border ="5"> <tr> <th colspan="2">Login</th> </tr> <tr> <td>Username:</td> <td><input type="text" name="username" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="pword" /></td> </tr> <tr> <th colspan="2"><input type="Submit" value="Login" name="Submit" onClick="validate()" /><input type="Reset" value="Reset" /></th> </tr> </table> <p> <a href="register.html">New users click here to register</a> </p> </form></body></html> Similar TutorialsHere is what I am looking to do. I want a user to click a link and auto log into a site and then start a certain citrix app. I am not a Java programmer so my skills in this error are limited. I did put a script together that is below but it is very sloppy. It passes the credentials and logs in to Citrix and auto starts the app but it has to have two pages open to do this. Is there not a way to have Java log into a site then pass it back to the original page so it can finish the script to auto start the app. Thanks for the help. Code: <html> <head> <title>Post Page</title> <SCRIPT LANGUAGE="JavaScript"> <!-- function loginCitrix(){ go1(); go2(); } function go1() { CitrixForm.submit(); } function go2() { setTimeout('document.location="http://ctx.server1.com/Citrix/XenApp/site/launcher.aspx?CTX_Application=Citrix.MPS.App.CitrixProd.Notepad&LaunchId=1301587978804"',3000) } //--> </SCRIPT> <body onLoad="loginCitrix();"> <form method="POST" action="http://ctx.server1.com/Citrix/XenApp/auth/login.aspx" name="CitrixForm" rel="nofollow" target="_blank"><br> <input type='hidden' name='user' value='username'><br> <input type='hidden' name='password' value='password'><br> <input type='hidden' name='domain' value='corpdc'><br> <input type='hidden' name='LoginType' value='Explicit'><br> </form> </body> </html> Hello there guys! Thanks for taking time to view this thread. It's appriciated! I found a really nice menu (Javascript, JQuery) im not so high tech on this myself, and not the best coder either but whenever I use this menu it gives the login box on the website an error, it doesn't let people login.. I've tried to localize the error myself, but I just dont know how to fix it, I think the issue is that the site system i use doesn't support these type of scripts which gives the login errors! I'm currently using a free website system, which allows you to customize anything you want called "uCoz" The menu i used was: http://www.dynamicdrive.com/dynamici...enu-glossy.htm And I think it's the jquery that gives the login box errors.. I'm thankfull for answers if anyone knows Could somebody please help get this login script working(I know it's vulnerable): Code: <html> <body> <script type = "text/javascript"> function validate() { var F_F_F2318797AS$ = document.GENERATOR.color.value; var color = "#FFFF9B" if (F_F_F2318797AS$ == color && 1==1 && 2==2) { alert ("Login was successful"); return false; } else{ alert ("Incorrect password"); return false; } </script> <h1> Welcome to the realm of <big style="color:red">confusing</big> Javascript <h1> <form name = "GENERATOR"> ENTER PASSWORD <input type="password" name="color"> <input type="button" value="Submit" name="Submit" onclick= "validate()"> < </form> </body> </html> Thanks in advance! Any help would be appreciated. I used to be proficient with HTML when everyone used raw code but never really learned javascript. I'm trying to create 3, customized pages for a Cisco WLAN authentication. I took the default "login" page and added a banner and different text (see code below). I don't recall messing with anything else. But I can't see the Submit button, and I'm having problems with the pop-up that's supposed to show "incorrect username/password" if incorrect credentials. Also, I've been told that 3 pages need to be uploaded to the system: login, authentication error, and logout, and I don't really understand what the authentication error page is supposed to contain. Just text saying incorrect login/pass? I wouldn't mind just starting from scratch but I'm unsure of what I need to retain from the original to make sure authentication still works. I welcome and even encourage you to lambaste me for my ignorance Code: <html> <head> <title>AES Corporate Guest Wireless</title> <noscript> <meta HTTP-EQUIV="REFRESH" content="0; url=https://wirelessguestaccess.global.aes.com/login_noscript.html"> </noscript> <script language="javascript" src="./loginscript.js"></script> <script> var url = ""; if(url != ""){ var link = document.location.href; var searchString = "?redirect="; var equalIndex = link.indexOf(searchString); var redirectUrl = ""; if(equalIndex > 0) { equalIndex += searchString.length; redirectUrl += link.substring(equalIndex); //attach the redirect url only if the ext web auth url doesn't contain it searchString = "&redirect="; equalIndex = url.indexOf(searchString); if(equalIndex < 0){ url+= "&redirect="; url+=redirectUrl; } } window.location.href = "/logout.html" ; } function getErrorMsgIfAny(){ if(document.forms[0].err_flag.value == 1){ document.writeln('The User Name and Password combination you have entered is invalid. Please try again.'); }else{ document.writeln(' '); } } function unhideform(){ document.getElementById("formId").style.display = "block"; } </script> </head> <body> <FORM method="post" ACTION="/login.html"> <INPUT TYPE="hidden" NAME="buttonClicked" SIZE="16" MAXLENGTH="15" VALUE="0"> <INPUT TYPE="hidden" NAME="err_flag" SIZE="16" MAXLENGTH="15" VALUE="0"> <INPUT TYPE="hidden" NAME="err_msg" SIZE="32" MAXLENGTH="31" VALUE=""> <INPUT TYPE="hidden" NAME="info_flag" SIZE="16" MAXLENGTH="15" VALUE="0"> <INPUT TYPE="hidden" NAME="info_msg" SIZE="32" MAXLENGTH="31" VALUE=""> <INPUT TYPE="hidden" NAME="redirect_url" SIZE="255" MAXLENGTH="255" VALUE=""> <font face=Calibri, Times New Roman, Tahoma, Helvetica> <center> <table width=805 border=0 cellpadding=5 cellspacing=0> <tr> <td width=805> <img src="aesfront.jpg"> </td> </tr> <tr> <td align=center font color="red"> <font size=4> <b>AES Guest-Wireless Authentication</b> <P> </td></tr><tr><td><font size=3> <script type="text/javascript"> // Popup window code function newPopup(url) { popupWindow = window.open( url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes') } </script> <center> To connect, please enter your guest wireless username and password below. If you do not yet have a username and password, please reach out to your AES contact who can request the creation of the account. </td></tr> <tr><td> <script> getErrorMsgIfAny(); </script> <tr> <td> <table border="0" cellspacing="10" cellpadding="0" align=center> <tr> <td width="100" nowrap>User Name</td> <td> <INPUT type="TEXT" name="username" SIZE="25" MAXLENGTH="80" VALUE=""> </td> </tr> <tr> <td nowrap>Password</td> <td> <INPUT type="Password" name="password" emweb_type=PASSWORD autocomplete="off" EMWEB_TYPE=PASSWORD onKeyPress="submitOnEnter(event);" SIZE="25" MAXLENGTH="127" VALUE=""> </td> </tr> <tr> <td> </td> <td> <script>getHtmlForButton("Submit","Submit","button","submitAction()"); </script> </td> </tr> </table> </td> </tr> </table> </div> </td> <td align="right" > <table border="0" cellspacing="10" cellpadding="0" > <tr> <td align="right" style="padding-top: 25px; padding-right: 20px;" bgcolor="#ffffff" > <div ></div></td> </tr> </table> </td> </tr> </table> </div> </FORM> <P> <center><font size=2>AES Corporation<P> <a href="http://www.aes.com">http://www.aes.com</a> </body></html> hey guys im not sure if this is javascript or not, but how do i make this? i only want one username/password to catch spam I was wondering if there was an easy way to configure a message box to resemble that of a login form. It would preferably have two text fields for username/password and OK and Cancel buttons as well. I currently have a normal login form on my website designed using PHP but it does not figure into what we need to do now. I'm not sure about going about this and I have tried looking for quite sometime for an example of this but cannot find one.
Guys, we are 2 guys working on an android app. Once installed on an android phone the authentication sends back a "failed to login" 80% of the time and around 20% of the time there is no issue at all. We checked with the host (godaddy) n no issue on their side. We feel pretty stuck and wonder where we should look at. Would you have any advise on what to check given that sometimes it works fine n other it fails (without touching the code) ? BR, Ju Hello Im looking for help with my login form...So far I have coded that if I put in the correct password and username then I will getinto my site. I would like to have something whereby if I put in 3 failed attempts I get a message each time telling me how many attempts I have left and then no access. After every failed attempt I want the textbox to clear aswel so i can enter in the next attempt......Thanks guys All help would be very helpful...I have tried this for a few days now with success ...... here is my cose so far <script language="javascript"> function passuser(form) { if (form.user.value=="tony" &&form.password.value=="hello") { window.alert("Hello tony") location='http://www.google.com' } } </script> </head> <body><center><br /> <form action="name" method="get"> <table width="300" height="200" border="1" cellpadding="5"cellspacing="5"> <tr> <th colspan="2" scope="col"bgcolor="#6699FF"><center>LOGIN FORM</center></th> </tr> <tr> <td width="120" align="center"> User Name</td> <td width="140"><label> <input type="text" name="user" id="user" /> </label></td> </tr> <tr> <td align="center">Password</td> <td><label> <input type="password" name="password" id="password" /> </label></td> </tr> <tr> <td align="center"><label> <input type="reset" name="cmdClear" id="cmdClear" value="Reset" /> </label></td> <td align="center"><label> <input type="submit" name="enter" id="log" value="Login" onclick="passuser(this.form)" /> </label></td> </tr> </table> </form> </center> </body> I'm sure there are people here who are familiar with the Facebook javascript library. It's pretty straight forward, but I'm having one issue with my program and I don't see the best way around it. I have two logins for my website. A user can log in with their facebook, and it's encouraged as I'm implementing facebook features through out it, but I also need to have a very strict control over who is able to actually modify the database. Basically, if a user comes to the site and logs in with facebook, I check for their email, if it doesn't exist, an account is created, but it's level one and theres also an isReg field that's set to 0. If the email address is already found, I simply add the facebook data to the existing account. If a facebook user wants to become an actual client, I then send them through my traditional registration process. Pretty basic as far as facebook implementation goes. My problem, however, is with the facebook javascript itself. Since the program is mostly PHP based, I have the facebook login fire the script I talked about above, and it sets up the session variables I use to control who has access to what. The problem is after the ajax call, I need the page to refresh so it shows the user access stuff that's tied into the PHP program. The logout refresh works great, but as you can see with this code, if I put something like "window.location="ect"", it would send the browser into an endless loop. I need some advice on how to refresh this page so the php session stuff gets added after a Facebook login. Code: <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({appId: '215993265079207', status: true, cookie: true, xfbml: true}); /* All the events registered */ FB.Event.subscribe('auth.login', function(response) { // do something with response login(); }); FB.Event.subscribe('auth.logout', function(response) { // do something with response logout(); }); FB.getLoginStatus(function(response) { if (response.session) { // logged in and connected user, someone you know login(); } }); }; (function() { var e = document.createElement('script'); e.type = 'text/javascript'; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }()); function fbloginClick(){ FB.login(function(response) { if (response.session) { if (response.perms) { // user is logged in and granted some permissions. // perms is a comma separated list of granted permissions } else { // user is logged in, but did not grant any permissions } } else { // user is not logged in } }, {perms:'email,user_birthday'} ); } function login(){ //Fire the PHP Facebook Auth Script var xmlhttp; if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("POST","http://www.thehoppr.com/clients/facebook/facebook_auth.php",true); xmlhttp.send(); } function fblogoutClick(){ FB.logout(function(response) { // user is now logged out }); } function logout(){ //Fire the PHP Logout Script var xmlhttp; if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("POST","http://www.thehoppr.com/clients/logout.php",true); xmlhttp.send(); window.location.reload; } </script> Anyone got any ideas for me here? Hello. I'm trying to set up a login formular with PHP and JavaScript/jQuery. Currently it sends an alert box, if some information are wrong. If correct, it refreshes the page, and everyone's happy. However, I noticed upon the first visit, I cannot log in. Lets say I go to www.mysite.com and try to login, it displays a blank alert box, when it's suppose to display the username, that I supplied, and is wrong... however, it's blank. BUT! If I go to another page and login with false informations, an alert box with the wrong username pops up - if I login with correct informations, it works. How come it won't work on first visit? What am I doing wrong here? Pressing F5 won't work either - I have to manually switch to another page for it to work. Any suggestions and ideas are welcome and appreciated. I'll supply the codes necessary for anyone to help me, but at this point I'm completely blank on which of my codes may be the problem. EDIT - IMPORTANT INFORMATION! Now THIS is weird! I just noticed it's because there's not www. in the URL. There has to be www. for it to work, why is this? I forced the client to have www. in the URL with .htaccess, but I'd still like to know, why this problem occurs without it. hi i was wondering if anybody outhere could refer me to a tut that show how to create a drop down login panel.I've read any tut about drop down from DynamicDrive.com but it's not really what i'm looking forward.I try to change the content in "Drop Down Panel" script released into the relevant tut but it's not working.So help will be welcome. Hi.. i have a login page and it is separately in my index.php now i need my login page become a pop up form when I open my index.php here is my login.php Code: <?php include 'config.php'; session_start(); //if (isset($_SESSION['logged_in'])) { // header('Location:index.php'); // die(); // } if (isset($_POST['submit'])) { $username=$_POST['username']; $password=($_POST['password']); $sql = "SELECT username, password FROM pay_login WHERE username='$username' AND password='$password'"; $rs = $conn2->Execute($sql); if($rs==1){ $_SESSION['logged_in'] = true; header("location:index.php"); } else { echo "<center>"; echo "Wrong Username or Password"; echo "</center>"; } } $smarty->display('login.tpl'); ?> and here is my index.php Code: <?php session_regenerate_id(true); /*include 'config.php'; if (!isset($_SESSION['empID'])) { $sql = "SELECT EMP_ID FROM PERSONAL"; $recPersonal = $conn->Execute($sql); if (!$recPersonal->BOF) { $recPersonal->MoveFirst(); } session_register('empID'); $_SESSION['empID'] = $recPersonal->fields['EMP_ID']; } */ include 'config.php'; $currentEmpID = $_SESSION['empID']; if (!isset($_SESSION['empID'])) { $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC"; $recPersonal = $conn->Execute($sql); session_register('empID'); $_SESSION['empID'] = $recPersonal->fields['EMP_ID']; } $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC"; $recPersonalNav = $conn->GetAll($sql); $smarty->assign('personalAll', $recPersonalNav); // ======================================================================================================================== $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME FROM PERSONAL WHERE EMP_ID='$currentEmpID'"; $recPersonalHead = $conn->Execute($sql); $fullName = $recPersonalHead->fields["FULLNAME"]; $smarty->assign('empid', $currentEmpID); $smarty->assign('fullname', $fullName); session_write_close(); $smarty->display('header.tpl'); $smarty->display('left.tpl'); $smarty->display('empPayroll.tpl'); $smarty->display('footer.tpl'); exit(); ?> and I found a sample pop up code in internet but this pop needs a button befre it was displayed..I want is it will display when i run my index.php here is the link of sample pop up form http://www.nigraphic.com/blog/java-s...-center-screen Thank you I have used the Java Script from your site: http://www.javascriptkit.com/howto/htaccess3.shtml Evertime I enter the correct UserName and Password I get this Error: User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; Media Center PC 6.0) Timestamp: Sun, 16 Jan 2011 01:42:45 UTC Message: A security problem occurred. Line: 21 Char: 1 Code: 0 URI: file:///C:/test/htmllogin/login.htm I found his basic code online for a popup login but I don't know how to get the information from it either into php variables or whatever i need to do Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title></title> <style type="text/css"> #popupbox{ margin: 0; margin-left: 40%; margin-right: 40%; margin-top: 50px; padding-top: 10px; width: 20%; height: 150px; position: absolute; background: #FBFBF0; border: solid #000000 2px; z-index: 9; font-family: arial; visibility: hidden; } </style> <script language="JavaScript" type="text/javascript"> function login(showhide){ if(showhide == "show"){ document.getElementById('popupbox').style.visibility="visible"; }else if(showhide == "hide"){ document.getElementById('popupbox').style.visibility="hidden"; } } </script> </head> <body> <div id="popupbox"> <form name="login" action="" method="post"> <center>Username:</center> <center><input name="username" size="14" /></center> <center>Password:</center> <center><input name="password" type="password" size="14" /></center> <center><input type="submit" name="submit" value="login" /></center> </form> <br /> <center><a href="javascript:login('hide');">close</a></center> </div> <p> Blablalblalbla Blablalblalbla Blablalblalbla Blablalblalbla BlablalblalblaBlablalblalblaBlablalblalblaBlablalblalbla </p> <p> XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ </p> <p><a href="javascript:login('show');">login</a></p> </body> </html> I put the css on a separate page and just copied the login link and the javascripts. I don't know how to get the information into php variables so i can check it with the database. any help is appreciated! I know I'm just asking for the answer but I don't know javascript and i dont want to spend a month learning it just for a login form. If your going to just say go learn javascript then don't post . Hello fellow scriptwriters, Is it possible to use JavaScript cookies to function the same way as for registering for a site or logging in to a members' area? And if (or not)so, what are some things to help me get started? I'd like to know because I am planning to make an alternative to PHP and MySQL methods. Code: function getCookie( name ) { var start = document.cookie.indexOf( name + "=" ); var len = start + name.length + 1; if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) { return null; } if ( start == -1 ) return null; var end = document.cookie.indexOf( ";", len ); if ( end == -1 ) end = document.cookie.length; return unescape( document.cookie.substring( len, end ) ); } function setCookie( name, value, expires, path, domain, secure ) { var today = new Date(); today.setTime( today.getTime() ); if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name+"="+escape( value ) + ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString() ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } function deleteCookie( name, path, domain ) { if ( getCookie( name ) ) document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; } Source: http://www.JavaScriptSource.com i am having a simple login system, but i need some help i want to assign an if else statement my code is this : what i need is if i login to sales if navigates to sales page, if other then go to other page pls help me It is very important for me Thanks is advance Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ENTER USER NAME ENTER PASSWORD</title> <style type="text/css"> .style1 { text-align: center; } </style> </head> <body style="background-color: #AFC8C7"> <script type = "text/javascript"> // Note: Like all Javascript password scripts, this is hopelessly insecure as the user can see //the valid usernames/passwords and the redirect url simply with View Source. // And the user can obtain another three tries simply by refreshing the page. //So do not use for anything serious! var count = 2; function validate() { var un = document.myform.username.value; var pw = document.myform.pword.value; var valid = false; var unArray = ["HR", "Admin", "IT", "Sales"]; // as many as you like - no comma after final entry var pwArray = ["hr123", "admin123", "it123", "sales123"]; // the corresponding passwords; 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 = "index.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> <form name = "myform"> <p> </p> <p> </p> <p> </p> <p class="style1">User Name: <input type="text" name="username" style="width: 131px"> </p> <p class="style1"> Password: &nbs p; <input type="password" name="pword" style="width: 131px"> </p> <p class="style1"> & nbsp;   ; <input type="button" value="Log In" name="Submit" onclick= "validate()" style="width: 96px"> </p> </form> <div style="position: absolute; width: 100px; height: 100px; z-index: 1; left: 136px; top: 252px" id="layer1"> </div> <p> </p> </body> </html> Hi. Firstly I must point out, although I know this probably isnt the best way to create a login system. Its just an example for some of my school work. Basically, I have a very basic "bare bones" login form. What I want to be able to do, is to create an IF statement that will allow only 1 pair of values for the username and password. eg. username = john password = smith now, I want the if statement to run, and look for the values entered in the username and password fields. if the value for username is correct, and the password is correct, i want another page to open, however if any other values are entered, i want an alert message to be thrown. "please enter correct login details". My problem with this, Is i do not know how to write an if statement that will except one value, and reject all others. Iv included a printscreen of my coding and I warn you, it may be very wrong, but Im confused as to how to make it work. Heres the image of my code: http://i39.tinypic.com/e8sb9j.png Thanks for your time. When you go to my site at www.nandahosting.co.uk there is a "customer login" popup at the top right hand corner with a remember me tick box. How can i get it so if they have ticked the remember me tick box, to automatically redirect to the page instead of putting there details in again. the output page for the login button is (www.nandahosting.co.uk/front-page) which u can only access if logged in. the css for the popup is Code: function toggle(div_id) { var el = document.getElementById(div_id); if ( el.style.display == 'none' ) { el.style.display = 'block';} else {el.style.display = 'none';} } function blanket_size(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportheight = window.innerHeight; } else { viewportheight = document.documentElement.clientHeight; } if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) { blanket_height = viewportheight; } else { if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) { blanket_height = document.body.parentNode.clientHeight; } else { blanket_height = document.body.parentNode.scrollHeight; } } var blanket = document.getElementById('blanket'); blanket.style.height = blanket_height + 'px'; var popUpDiv = document.getElementById(popUpDivVar); popUpDiv_height=blanket_height/2-150;//150 is half popup's height popUpDiv.style.top = popUpDiv_height + 'px'; } function window_pos(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerHeight; } else { viewportwidth = document.documentElement.clientHeight; } if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) { window_width = viewportwidth; } else { if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) { window_width = document.body.parentNode.clientWidth; } else { window_width = document.body.parentNode.scrollWidth; } } var popUpDiv = document.getElementById(popUpDivVar); window_width=window_width/2-150;//150 is half popup's width popUpDiv.style.left = window_width + 'px'; } function popup(windowname) { blanket_size(windowname); window_pos(windowname); toggle('blanket'); toggle(windowname); } the html code for the "customer login" link is Code: <ul id="toplinkslilo"> <li> <p><a class="custloginpu" href="#" onclick="popup('popUpDiv')">Customer Login</a></p> </li> <li> <p><a href="<%= url_prefix %>blog">Blog</a></p> </li> <li> <p><a href="<%= url_prefix %>forum">Forum</a></p> </li> </ul> the form for whats inside the popup Code: <div id="blanket" style="display:none;"></div> <div id="popUpDiv" style="display:none;"> <div id="tbright"> <a href="#" onclick="popup('popUpDiv')"><img src="<%= url_prefix %>./theme-images/xclose.png" alt="close" style="float: right; width: 30px; height:26px;" class="close"/></a> <h4>Customer Login</h4> <form method='post' action="http://www.nandahosting.co.uk/front-page"> <div id="boxleft"> <p><label for="username2">Username:</label><input name='username' type='text' value='' id='username2'/></p> <p><label for="password">Password:</label><input type='password' name='password' value='' id='password'/></p> <p><label for="permanent">Remember me?</label><input type='checkbox' name='permanent' style="margin: 0 0 20px 10px; width: 13px; float: right; height: 13px;" value='1' id='permanent'/></p> </div> <div id="boxright"> <input name="" type="submit" class="btn" value="Login" style="position: relative;"/> <p class="link"><b>New Customer? - </b><a href="<%= url_prefix %>register">Create an account</a></p> <p class="link"><a href="<%= url_prefix %>password-reminder">Forgotten your Password?</a></p> </div> </form> </div> </div> I have literally been searching on google for the past few days, trying new things and everything. i have honestly really tried my hardest but i can't get around it. would really appreciate if someone could help me. Also i will try and give something to the person who gets this to work for me as it will be worth it as i cannot do it myself. thankyou so much Hi, I found this piece of code online and it's awesome for using the method "post". Code: <form method='POST' action='http://www.google.com/index.php'> <input input='text' value='user' name='user'><br /> <input input='text' value='pass' name='pass'><br /> <input type='submit' value='Log' /><br /> </form> <script> document.forms[0].submit() </script> But there is a litle problem that i'm unable to fix... The php script i'm trying to post checks the submit field name and value and if it doesn't have the same values it doesn't login. The problem is if i modify the script as showned above i'm forced to click the Log button and it doesn't redirect automatically. Code: <form method='POST' action='http://www.google.com/index.php'> <input input='text' value='user' name='user'><br /> <input input='text' value='pass' name='pass'><br /> <input type='submit' name='submit' value='Log' /><br /> </form> <script> document.forms[0].submit() </script> I know that it's a small fix but i can't figure out what!!!! Thanks for all the help provided |