| | |
Can't get login to work online!!!!!
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2005
Posts: 10
Reputation:
Solved Threads: 0
I am working on this site which has a login page, it is up live and works fine from my computer but can't get it to work anywhere else.
This is the code:
<form>
<p><B><FONT SIZE="2" FACE="ARIAL">USER NAME :</B>
<input type="text" name="text2">
</p>
<p><B>PASSWORD :</B>
<input type="password" name="text1">
<input type="button" value="Login" name="Submit" onclick=javascript:validate(text2.value,"tekko",text1.value,"sydney") >
</p>
</form>
<script language = "javascript">
function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('success.html');
else
{
load('failure.html');
}
}
function load(url)
{
location.href=url;
}
</script>
Does anyone know what I'm doing wrong?
This is the code:
<form>
<p><B><FONT SIZE="2" FACE="ARIAL">USER NAME :</B>
<input type="text" name="text2">
</p>
<p><B>PASSWORD :</B>
<input type="password" name="text1">
<input type="button" value="Login" name="Submit" onclick=javascript:validate(text2.value,"tekko",text1.value,"sydney") >
</p>
</form>
<script language = "javascript">
function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('success.html');
else
{
load('failure.html');
}
}
function load(url)
{
location.href=url;
}
</script>
Does anyone know what I'm doing wrong?
•
•
Join Date: Jun 2005
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by tgreer
You don't need the "javascript:" in the onclick attribute. Other than that, I'd need to know more about the specific problem. You might need full URLs rather than just filenames for "success.html" and "failure.html". What error are you getting?
cheers
cynch
I can't help but ask. cynch, you do realize that this login script has zero security value, right? The username and password are written out to the browser and viewable in the source code.
cynch, for what it's worth, if your server supports PHP, I submitted what I think is an elegant code solution for managing user sessions and password-protecting PHP pages. It's here on Daniweb in the Code Snippets section.
http://www.daniweb.com/code/snippet291.html
You do need to be a programmer, though, to incorporate the class. I've included a lot of comments and example usage in the code.
http://www.daniweb.com/code/snippet291.html
You do need to be a programmer, though, to incorporate the class. I've included a lot of comments and example usage in the code.
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
I am having the same problem. Do i have to make a 'Sign Up' page before the log in code works?
the code that i have is:
the code that i have is:
HTML Syntax (Toggle Plain Text)
<form> <p align="right"><font color="#FFFFFF" size="3" face="Baskerville Old Face">Username: <input type="text" name="text2"></font> </p> <p align="right"><font color="#FFFFFF" size="3" face="Baskerville Old Face"> Password: <input type="password" name="text1"></font> <br><br><input type="button" value="Log In" name="Submit" onclick=validate(text2.value,"Username #1",text1.value,"Password#1") > </p> </form> <script language = "javascript"> function validate(text1,text2,text3,text4) { if (text1==text2 && text3==text4) load('success.htm'); else { load('failure.htm'); } } function load(url) { location.href=url; } </script>
Last edited by peter_budo; Jan 18th, 2009 at 2:00 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Login used to work (ASP.NET)
- Work offline is default (Web Browsers)
- vB Sessions/Online list (PHP)
- IE wont work :-( (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Display iframe source in web browser's address bar
- Next Thread: content silding help!
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxhelp animate array automatically beta box bug calendar captcha cart checkbox class codes column cookies createrange() css cursor date debugger decimal design dom download dropdown editor element enter error events explorer firefox focus form frameworks getselection google gwt html htmlform iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jsp listbox maps masterpage matrixcaptcha menu microsoft mimic mp4 object onmouseover parent php player post problem programming progressbar prototype rating redirect regex runtime safari scale scriptlets search select session shopping size sql starrating stars text textarea toggle validation variables w3c website window windowofwords windowsxp wysiwyg xml






