Griffeyman04
12-08-2002, 06:52 PM
please! help me! i really want to know how!oh, and please put instructions how to use it, thnx!:D
|
Click to See Complete Forum and Search --> : HELP! How Do I create a login form?What is the html code for it? Griffeyman04 12-08-2002, 06:52 PM please! help me! i really want to know how!oh, and please put instructions how to use it, thnx!:D Zach Elfers 12-08-2002, 08:23 PM Hold on. I just made one. What a coincidence. It should be uploaded to my site tonight. I will name it www.geocities.com/lordoftheringsandtolkien/login.html Hope it's what your looking for! jeffmott 12-08-2002, 08:29 PM See http://www.w3.org/TR/html401/interact/forms.html for details on how to create forms. Zach Elfers 12-08-2002, 08:31 PM He wants a login form. Not a form. Zach Elfers 12-08-2002, 08:41 PM Here's the script for the login form. I have the JavaScript in an external file. HTML code (login.html): <html> <head> <title>Please type your Username and Password... </title> <script language="JavaScript" type="text/JavaScript" src="login.js"></script> </head> <body bgcolor="#eeeeee"> <form> <br> <center> Username: <input type="text" name="username" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"> <br> Password: <input type="password" name="password" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"> <br> <input type="button" value="Login" onClick="Login(this.form);" style="background:#bfbfbf;color:#000000;border-color:#212121;" onMouseOver="this.style.color = '#404040';" onMouseOut="this.style.color = '#000000';" onFocusr="this.style.color = '#404040';" onBlur="this.style.color = '#000000';"> </center> </form> </body> </html> You can change the appearance. External JavaScript code (login.js): <!-- Begin function Login(form) { username = new Array("u1","u2","u3","u4","u5","u6","u7","u8","u9","u10"); password = new Array("p1","p2","p3","p4","p5","p6","p7","p8","p9","p10"); page = "secretpage" + ".html"; if (form.username.value == username[0] && form.password.value == password[0] || form.username.value == username[1] && form.password.value == password[1] || form.username.value == username[2] && form.password.value == password[2] || form.username.value == username[3] && form.password.value == password[3] || form.username.value == username[4] && form.password.value == password[4] || form.username.value == username[5] && form.password.value == password[5] || form.username.value == username[6] && form.password.value == password[6] || form.username.value == username[7] && form.password.value == password[7] || form.username.value == username[8] && form.password.value == password[8] || form.username.value == username[9] && form.password.value == password[9]) { self.location.href = page; } else { alert("Either the username or password you entered is incorrect.\nPlease try again."); form.username.focus(); } return true; } // End --> You can change the page = "secretpage" + ".html"; to whatever you want. The passwords are stored in arrays, I have just made the passwords u1, p1 for username1 and password1, but you can make them whatever you want.:) jeffmott 12-08-2002, 08:51 PM I see, so you think that information on creating and submitting forms is irrelevant to creating a login form? There are two main parts to a working user login. The HTML form and the server-side program (unless you use insecure client-side scripting). Thier question was posted in the HTML forum hence they received the HTML answer. The official docs would be a far better place to learn than someone's personal page. As far as the server-side programming, they won't be able to view this from your site anyway, unless you provide a text document of the source. Zach Elfers 12-08-2002, 08:54 PM sorry. I'm stupid. jeffmott 12-08-2002, 08:54 PM I have the JavaScript in an external file AKA insecure client-side method. Anyone with moderate knowledge would be able to crack this in a matter of seconds. Zach Elfers 12-08-2002, 08:57 PM Yeah, I know. I made this just for fun, not for something secure. I don't have my own domain, so I am not able to use sercure server-side scripting. I put this in an external JS, just to keep amateurs out. Anybody else could get in. kagome 02-28-2007, 07:35 PM umm.. w3n i tried it out for muhself n cliked log in nutin happend buh w3n i cliked ur thang n i clikd log in it sed da usaname or pass was wrong n how is da thang supposed ta kno? plz tell m3 or email my bak at r4nm4_saotome@yahoo.com... plz tell may;) aall give ya a kisss:p cuz aam da hottest chick round da place :cool: Here's the script for the login form. I have the JavaScript in an external file. HTML code (login.html): <html> <head> <title>Please type your Username and Password... </title> <script language="JavaScript" type="text/JavaScript" src="login.js"></script> </head> <body bgcolor="#eeeeee"> <form> <br> <center> Username: <input type="text" name="username" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"> <br> Password: <input type="password" name="password" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"> <br> <input type="button" value="Login" onClick="Login(this.form);" style="background:#bfbfbf;color:#000000;border-color:#212121;" onMouseOver="this.style.color = '#404040';" onMouseOut="this.style.color = '#000000';" onFocusr="this.style.color = '#404040';" onBlur="this.style.color = '#000000';"> </center> </form> </body> </html> You can change the appearance. External JavaScript code (login.js): <!-- Begin function Login(form) { username = new Array("u1","u2","u3","u4","u5","u6","u7","u8","u9","u10"); password = new Array("p1","p2","p3","p4","p5","p6","p7","p8","p9","p10"); page = "secretpage" + ".html"; if (form.username.value == username[0] && form.password.value == password[0] || form.username.value == username[1] && form.password.value == password[1] || form.username.value == username[2] && form.password.value == password[2] || form.username.value == username[3] && form.password.value == password[3] || form.username.value == username[4] && form.password.value == password[4] || form.username.value == username[5] && form.password.value == password[5] || form.username.value == username[6] && form.password.value == password[6] || form.username.value == username[7] && form.password.value == password[7] || form.username.value == username[8] && form.password.value == password[8] || form.username.value == username[9] && form.password.value == password[9]) { self.location.href = page; } else { alert("Either the username or password you entered is incorrect.\nPlease try again."); form.username.focus(); } return true; } // End --> You can change the page = "secretpage" + ".html"; to whatever you want. The passwords are stored in arrays, I have just made the passwords u1, p1 for username1 and password1, but you can make them whatever you want.:) fozze 03-19-2007, 12:12 PM just wondering if you could make this login script go to multiple destinations? the code is... <!-- Begin function Login(form) { username = new Array("u1","u2","u3","u4","u5","u6","u7","u8","u9","u10"); password = new Array("p1","p2","p3","p4","p5","p6","p7","p8","p9","p10"); page = "http://www.google" + ".com"; if (form.username.value == username[0] && form.password.value == password[0] || form.username.value == username[1] && form.password.value == password[1] || form.username.value == username[2] && form.password.value == password[2] || form.username.value == username[3] && form.password.value == password[3] || form.username.value == username[4] && form.password.value == password[4] || form.username.value == username[5] && form.password.value == password[5] || form.username.value == username[6] && form.password.value == password[6] || form.username.value == username[7] && form.password.value == password[7] || form.username.value == username[8] && form.password.value == password[8] || form.username.value == username[9] && form.password.value == password[9]) { self.location.href = page; } else { alert("Either the username or password you entered is incorrect.\nPlease try again."); form.username.focus(); } return true; } // End --> Major Payne 03-20-2007, 01:41 AM umm.. w3n i tried it out for muhself n cliked log in nutin happend buh w3n i cliked ur thang n i clikd log in it sed da usaname or pass was wrong n how is da thang supposed ta kno? plz tell m3 or email my bak at r4nm4_saotome@yahoo.com... plz tell may;) aall give ya a kisss:p cuz aam da hottest chick round da place :cool: Aside from not being able to read what you said :rolleyes: , I hope you like spam, because you entered your email address :eek: for all bots and quirky people. Cheers... Ron PinkDady 10-12-2007, 03:35 AM Okay guys, I used Zach Elfers's code and it worked fine for me, and now the question is, how do I code the check box to remember my user name and password every time I log on...... Like in the code below..... NB: I copied Zach's code and only inserted a check box.... Run it and see how it looks like... <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Username</title> </head> <body> <html> <head> <title>Please type your Username and Password... </title> <script language="JavaScript" type="text/JavaScript" src="login.js"></script> </head> <body bgcolor="#eeeeee"> <form> <br> <center> Username: <input type="text" name="username" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"> <input type="checkbox" name="C1" value="ON">Remember Me?<br> Password: <input type="password" name="password" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"> <br> <input type="button" value="Login" onClick="Login(this.form);" style="background:#bfbfbf;color:#000000;border-color:#212121;" onMouseOver="this.style.color = '#404040';" onMouseOut="this.style.color = '#000000';" onFocusr="this.style.color = '#404040';" onBlur="this.style.color = '#000000';"></center> </form> </body> </html> </body> </html> newbie10101 11-11-2007, 06:13 PM I get how to put the thingie on a webpage, but how do I get it to work? And how do I place a spot for members to register? I have a freewebs site, just in case that would change anything.... Chedly 08-05-2008, 05:53 AM all you have to do is copy the url of your home page and you dont need to login. is there a code to block the page until you log in, i kno they have like a two line code in asp and php, but i dont like either of them. technics 12-19-2008, 05:27 AM can someone please help: I'm wanting to make a simple dummy login page (like the one in earlier in this thread) and simply want to set it up so that regardless of what details a user puts in, a dialog box appears saying that the username/password entered is incorrect and that they should contact the administrator for the correct details. can you please tell me the code so that I can use it. Much appreciated. also I'd like to change the font that would appear on the login button. thanks Mayday 12-23-2008, 03:32 PM can someone please help: I'm wanting to make a simple dummy login page (like the one in earlier in this thread) and simply want to set it up so that regardless of what details a user puts in, a dialog box appears saying that the username/password entered is incorrect and that they should contact the administrator for the correct details. can you please tell me the code so that I can use it. Much appreciated. also I'd like to change the font that would appear on the login button. thanks Wow am I the only one who thinks that sounds like someone is trying to illicitly capture other people's passwords??? Here's a better idea. Forget about it and stop trying to hack others' accounts. Prateek9934 09-29-2009, 07:13 AM Where do i put the username and password. If the username is abcd and password is 1234 nathagt 02-01-2010, 05:08 PM Yeah, I know. I made this just for fun, not for something secure. I don't have my own domain, so I am not able to use sercure server-side scripting. I put this in an external JS, just to keep amateurs out. Anybody else could get in. where do I place the external JS to make this work? Juttman88 09-16-2010, 12:00 PM I got what you guys was talking about to work but how can i work that in to this, <div style="float: right; text-align: right; font-weight: bold; color: white;"> <H3></H3> <Provisional users can't create forms action="operations0.php" onSubmit="rememberinput('pilot', )" style="margin: 0px; padding: 0px; margin-top: 70px; margin-right: 3px;" method="POST"> <table align="left" cellpadding="0" cellspacing="3" style="background: url('/Images/background.png'); font-weight: bold; color: white;"> <tr><td colspan="2" style="color: white; font-weight: bold;">Pilot Login:</td></tr> <tr><td style="color: white; font-weight: bold;">Pilot ID:</td><td class="top"><input type="text" name="pilot"></input></td></tr> <tr><td style="color: white; font-weight: bold;">Password:</td><td class="top"><input type="password" name="password"></input></td></tr> <tr><td style="color: white; font-weight: bold;">Division:</td><td class="top" align="right" colspan="2"> <select name="airline"> <option value="SIA">Passenger</option> <option value="SQC">Cargo</option> </select> </td></tr> <tr><td align="right" colspan="2"><input style="background: clear; border: none;" type="image" src="/images/login.png"></input></td></tr> </table> </form> </div> PLZ HElp bigboy 10-13-2010, 09:09 PM Wow am I the only one who thinks that sounds like someone is trying to illicitly capture other people's passwords??? Here's a better idea. Forget about it and stop trying to hack others' accounts. i dont think he trying to hack it. like me i know that u put your page site url in there some where but where do u put it so it can work right i think he was tryin to test it to see if it work right its not like it got url go here or email go there what i need to know is how to do the login html the sing up html and a html for if they for get there password my site will send it to them stefanraj 10-20-2010, 01:57 AM this is the simple way to create a login form using HTML & PHP, <?php session_start(); # DISABLE REGISTER GLOBALS IF CONFIGURED IN PHP.INI ini_set('register_globals', false); ############################# COPYRIGHT ################### ######### This script is release under GPL/UGN Copyright Rules ######### Script by www.webune.com ######### Please do not remove this message. Thanks. echo' <div style="float:left;padding-left:10px;"> <a href="http://www.webune.com"> <img src="http://www.webune.com/images/headers/default_logo.jpg" border="0" align="Webune Logo"> </a> </div> <h1 style="float:left">Login Form Example</h1> <div style="clear:left;"></div> <hr />'; $Warning = '<hr> <div style="font-weight:bold; color:#FFF; font-size:18px; background-color:#F00"> IMPORTANT: Please use this script only for learning purposes. Under no circumstances use this exact code to implement on a production website. This script is NOT SECURED!!! This script lacks many security rules and guidelines to implement on a live website. Again, Use this script for learning purposes. If you need to learn more about login and password security, visit us at www.webune.com. Thank You for trying our script. </div>'; if($_GET['logout'] == 'yes'){ $_SESSION['ConfigUserSess'] = ''; $_SESSION['ConfigPasswdSess'] = ''; echo '<div style="font-weight:bold; color:#060; font-size:18px; text-align: center;" >Congratulations!!!<br><br> **** You Are Now Logged Out ****</div><br><br> Visit <a href="http://www.webune.com">Webune.com</a> For more Tutorials Like This<br><br> <a href="'.$_SERVER['PHP_SELF'].'">Click Here To Login Again</a>'.$Warning; exit; } #### CONFIGURE #### # WHEN THE USER SUBMITS THE FORM. THESE VALUES MUST MATCH $ConfigUser = 'foo'; $ConfigPasswd = 'secret'; #### STOP CONFIGURE #### if($_SESSION['ConfigUserSess'] == $ConfigUser && $_SESSION['ConfigPasswdSess'] == $ConfigPasswd){ # THE USER IS ALREADY LOGGED IN echo '<div style="font-weight:bold; color:#060; font-size:18px; text-align: center;"> Congratulations !!! - You are already logged in. </div><br> <a href="'.$_SERVER['PHP_SELF'].'">Click Here To Continue</a><br><br> <a href="'.$_SERVER['PHP_SELF'].'?logout=yes">Click Her To Logout</a>'.$Warning; }else{ # FUNCTION TO DISPLAY LOGIN FORM AND ERROR MESSAGES function LoginForm($Errors){ # DISPLAY ANY ERRORS IN RED COLORS echo '<div style="color:red;">'.$Errors.'</div>'; ?> <form name="form1" method="post" action=""> <p>Username: <input type="text" name="LoginName"> [ Enter: foo ] </p> <p>Password: <input type="password" name="UserPassword"> [ Enter: secret ] </p> <p> <input type="submit" name="Login" value="Login"> </p> </form> <?php } # CHECKS IF LOGIN FORM HAS BEEN SUBMITTED if(isset($_POST['Login'])){ # CHECK IF USERNAME AND PASSWORD MATCH WITH CONFIGURATION if(!$_POST['LoginName'] || !$_POST['UserPassword']){ LoginForm('ERROR: All Fields Are Required.'); }else{ if($_POST['LoginName'] == $ConfigUser && $_POST['UserPassword'] == $ConfigPasswd){ # USERNAME AND PASSWORD MATCH. GIVE USER COOKIE TO LOG USERNAME AND PASSWORD $_SESSION['ConfigUserSess'] = $ConfigUser; $_SESSION['ConfigPasswdSess'] = $ConfigPasswd; echo $_POST['user'].'<div style="font-weight:bold; color:#060; font-size:18px; text-align: center;" > Congratulations !!! - IT WORKS !!! You are already logged in.</div><br> <a href="'.$_SERVER['PHP_SELF'].'">Click Here To Continue</a><br><br>'.$Warning;; }else{ # USERNAME AND PASSWORD DO NOT MATCH. - SHOW FORM LoginForm('ERROR: Your Username and Password Do Not Match.<br>Try Again.<br> Username: foo<br>Password: secret<br>'); } } }else{ # FORM HAS NOT BEEN SUBMITTED. SHOW LOGIN FORM LoginForm('All Fields Are Required - You are Not Logged In.'); } } ?> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |