Mengao Posted March 29, 2007 Share Posted March 29, 2007 I was trying to make a simple login code but it's not working. Does anyone know what did I do wrong? <html><body><script type="text/javascript">function login(){if (user==="test" && pass==="test")document.write('Hello, welcome' +user+ '; What would you like to do?')}{elsealert('Your password is wrong!')} </script><input type="text" name="user" value="" id="pass" /><input type="password" name="pass" value="" id="pass" /><input type="button" name="login" value="Login" onclick="login()" /></body></html> Link to comment Share on other sites More sharing options...
aspnetguy Posted March 29, 2007 Share Posted March 29, 2007 This login system is useless because any users can view the source and see the username and password. Link to comment Share on other sites More sharing options...
Mengao Posted March 29, 2007 Author Share Posted March 29, 2007 i don't understand what you mean Link to comment Share on other sites More sharing options...
pulpfiction Posted March 29, 2007 Share Posted March 29, 2007 Javascript is client side scripting. user can right-click in the browser and "view source" and it will show all the javascript. along with the username and password. so it is not a good method. Link to comment Share on other sites More sharing options...
Mengao Posted March 29, 2007 Author Share Posted March 29, 2007 so which language is the best to program a login code? Link to comment Share on other sites More sharing options...
aspnetguy Posted March 29, 2007 Share Posted March 29, 2007 any server side language like ASP.Net or PHP Link to comment Share on other sites More sharing options...
pulpfiction Posted March 29, 2007 Share Posted March 29, 2007 Serverside scripting: ASP tutorials: http://w3schools.com/asp/default.aspPHP tutorials: http://w3schools.com/php/default.aspHere's a simple PHP login script... [this example takes only password, you can include username also.]http://forums.tizag.com/showthread.php?t=239ASP:http://www.asp101.com/samples/viewasp.asp?file=login.asp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now