whats up with my login script???

tyroneclark
tyroneclark used Ask the Experts™
on
i have done this login script:

<font color="#ffffff">Username: </font>
              <input name="text2" type="text" value="">
            </p>
            <p></p>
            <p><font color="#ffffff">Password: </font>
              <input name="text1" type="password">
              <br>
              <br>
              <input type="submit" value="Sign in" name="Submit" onClick=javascript:validate(text2.value,"free",text1.value,"javascript") >
            </p>
            <script language = "javascript">

function validate(text1,text2,text3,text4)
{
 if (text1==text2 && text3==text4)
 load('loggedin.html');
 else
 {
  load('failure.html');
 }
}
function load(url)
{
 location.href=url;
}
</script>

I have done everything as i found it done on other sites, although i cant login when i try it, unless i put "test" as the username and "javascript" as the password.

my website hasnt got a mySQL database, and i have to do it in java script or html...so i must be able to do it.

Please help me as soon as possible.

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
I'm not sure what it is that you're trying to accomplish. your question asks "...i cant login when i try it, unless i put "test" as the username and "javascript" as the password." Isn't that what you want? You're comparing those very strings as part of your validation...
In any case here's a version that is perhaps a bit more clear:

<HTML>
<HEAD>
<script language = "javascript">

     function validate() {
          if (f1.usernameField.value == "free" && 
              f1.passwordField.value == "password") {
               load('loggedin.html');
          } else {
               load('failure.html');
          }
     }
     function load(url) {
          location.href=url;
     }
</script>
</HEAD>
<BODY>
<form name="f1">
     <font color="#ffffff">Username: </font>
    <input name="usernameField" type="text" value="">
    </p>
    <p></p>
    <p>
    <font color="#ffffff">Password: </font>
    <input name="passwordField" type="password">
    <br>
    <br>
    <input type="button" value="Sign in" name="Submit" onClick="javascript:validate()">
    </p>
</form>
</BODY>
</HTML>

Author

Commented:
ok, thanks...but how do show which usernames and passwords are allowed? because i dont see how you see that.

Author

Commented:
ok, thanks...but how do show which usernames and passwords are allowed? because i dont see how you see that.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
ok, thanks...but how do show which usernames and passwords are allowed? because i dont see how you see that.

Commented:
What's the point of showing the usernames and passwords to the user, and then making the user enter them?
Why not just let them in?
Am I missing the point?

Author

Commented:
no, what i mean by other people seeing it, is that if they right click on the window and click view source, all they have to do is go down to the script see what username and password is, then enter them. and im trying to protect a specific page from other users, as it has sensitive information on it...i tried using a script to disable right click:

<head>
<script type="text/javascript">
function disable()
{
if (event.button == 2)
{
alert("Sorry no rightclick on this page.\nYou cannot view my source\nand you cannot steal my images.")
}
}

</script>
</head>
<body onmousedown="disable()">

but it didnt work.

Author

Commented:
i also need to know how to add multiple usernames and passwords, because i have 8 or 9 people that need to look at this information.

Commented:
I see.
Some sort of server side mechanism is really the only way to this securely, at least as far as I know. You say you have no access to mySQL, but can you run perl on your server? If so, you could keep a list of user names and passwords in a secure area, then have a perl script do the lookup for you.

Author

Commented:
i am using a sub domain on hypermart.net my site is http://coldesigns.hypermart.net/ and i have just found out that i can use mySQL, could you possibly give me a script with comments on about writing a. SQL login system? thanks

Author

Commented:
sorry im mistaken on that, i cant use mySQL, but i can use perl...can u possibly give me a perl login script for it please?

Author

Commented:
is there a possible way to make a login script from VBscript? if there isnt, what do i use to write perl code? because the program im using - Dreamweaver MX - doesnt support PERL script, which is pretty sh*te. thanks

Commented:
Could you write it by hand?

Author

Commented:
hehe...what i mean is, how can i show that the script is in PERL if Dreamweaver doesnt allow it as an option....do i insert a file...you never answered my question about the VBscript, can i use it? thanks alot for all this help :D
Commented:
To disable the context menu try the following code:

Script language='Javascript'>
<!--
var msg="Hands off my images you thieving b*****d";
function click(e) {
 if (document.all) {
  if (event.button == 2) {
   alert(msg);
return false;
 }}
 if (document.layers) {
 if (e.which == 3) {
   alert(message);return false;
}}}
if (document.layers) {
 document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
--></script>

This works for me in IE only though so it isn't a perfect solution.

Cheers

Umbriel
Michel PlungjanIT Expert
Top Expert 2009

Commented:
tyroneclark,
No comment has been added lately (261 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: split points between ebk88 http:#7455490 and Umbriel http:#7654660

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

mplungjan
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial