JavaScript - Help With Login Script
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! Similar TutorialsHello 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> Here 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> 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> 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 Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. 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.
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 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? 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 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 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. 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. 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 . 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 |