Login Code

This is a discussion on "Login Code" within the JavaScript Forum section. This forum, and the thread "Login Code are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 23rd, 2005, 12:08
New Member
Join Date: Mar 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kookie09
Login Code

I have a website I am building for school. It is done in Frontpage.. ya go ahead and laugh but I had no choice. I would like to add a login for members of the site and I found a code in javascript that works for one name and password but I'm not sure how to add more names and passwords.. what I have tried hasn't worked. Does anyone have a code or know how to add to this one?? Any help would be appreciated.

function authUser(form) {
if (form.Username.value=="kookie09") {
if (form.Password.value=="flossy") {
location="Local Clubs.htm"
} else {
if (form.Username.value=="giggen") {
if (form.Password.value=="celica") {
location="Local Clubs.htm"
} else {
location="UnAuthorized.html"
}
} else {
location="UnAuthorized.html"
}
}

  #2 (permalink)  
Old Mar 23rd, 2005, 12:46
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
You definitly DO NOT want to use javascript for 'login' functionality.

This is because anyone hitting 'view -> source' will see the usernames and passwords.

You really want some sort of SERVER SIDE scripting for this.

Javascript login scripts are unheard of... simply because they offer no security what-so-ever.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #3 (permalink)  
Old Mar 23rd, 2005, 13:40
Junior Member
Join Date: Sep 2003
Location: Dubai, United Arab Emirates
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Login Code

Quote:
Originally Posted by kookie09
I have a website I am building for school.
Just out of interest, what kind of school is it?

It's a jolly bad idea as rob says. Rather like hiding your key under the door mat. Anyone who wanted to break in would have a quick look there, just to see if you were really careless enough with your security to leave it there.
  #4 (permalink)  
Old Mar 23rd, 2005, 14:11
New Member
Join Date: Mar 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kookie09
thanks

Rob-Well... I'm not too concerned about security, its only for show for the class and if I ever host it live I wont have a login or anything but that is a very useful tip. I will have to keep that in mind for future. Lots more studying to do lol.

GillBates-I'm just doing a very wasteful Computer Systems Technician course at the local college. I realised too late its a big waste of money for what I'm getting out of it and will have to head to Waterloo or U of T when I find financing.
  #5 (permalink)  
Old Mar 23rd, 2005, 16:44
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
u dont need money to learn this stuff.

i think most of the users of this website, and in fact most of really good web-dudes out there are self-taught.

just stick around and you'll pick it up...


btw: GillBates, you crack me up! love you site! 8)
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #6 (permalink)  
Old Apr 21st, 2005, 23:12
New Member
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Never use this, veiw source will let people bypass it as previously mentioned, however:

Code: Select all
// change your file Local Clubs.htm to Local_Clubs.htm
// do not use spaces in filenames!

var usrs = [
["bob","bobspassword"],
["ann","annspassword"],
["bill","billspassword"],
["john","johnspassword"]
];

function chkusr(u,p){ 
  var flag = 0;
  for (var a=0; a<=usrs.length;a++){
      if (u == usrs[0][0] && p == usrs[0][1]){flag++;break;}
  }
  return flag;
}

function authUser(){
   var myu = document.form.username.value;
   var myp = document.form.username.value;
   var redirstr = (chkusr(myu,myp))?"Local_Clubs.htm":"UnAuthorized.html";
window.location.href=redirstr;
}
if worst comes to worst look up paj's MD5 and SHA1 algorthm and store the password and username as those instead to afford basic security... then again they can always look up the redirect so its futile.
Closed Thread

Tags
login, code

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
code behind code doesnt work skat ASP.NET Forum 4 Feb 18th, 2008 10:05
PHP Login Jack Franklin PHP Forum 25 Oct 10th, 2007 09:27
live search code and styleswitcher code hebel JavaScript Forum 0 May 12th, 2007 06:16
Php login cbrams9 PHP Forum 1 Sep 14th, 2006 22:05
Can somebody give me the code to hide the source code? renren JavaScript Forum 7 Mar 7th, 2006 12:27


All times are GMT. The time now is 10:17.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43