Log In · Register

 
Login access
pandemonium
post Jul 23 2009, 04:39 PM
Post #1


the name's mario
******

Group: Official Member
Posts: 1,270
Joined: Jun 2008
Member No: 656,520



ok. i don't know how to have pages accesable to only some ppl..
no. i don't want to password protect the directory, it only gives you one username..
ok here it is what im planning
have a staff.sitename.com subdomain and have all of the pages under the staff subdomain to be protected.. i want to have a login system which is going to be accessible to about 10 ppl & each have they're own username.

how do i do that?
did i explain myself correctly?
PS. i want to use html not php
and i have XAMPP for testing pages just in case..
 
 
Start new topic
Replies
heyo-captain-jac...
post Jul 23 2009, 05:41 PM
Post #2


/人◕‿‿◕人\
*******

Group: Official Member
Posts: 8,283
Joined: Dec 2007
Member No: 602,927



I wrote a really basic one, it's not going to be the most secure login form, but it will get the job done.

The second one has to be saved as "passList.js" in the same directory as the first one.

CODE

<html>
<head>
<title>Login</title>
<script src="passList.js"></script>
<script>
<!-- Begin
nameSW = false
passwordSW = false


function getUser() {
if (names.length != passwords.length) {alert("Database error!");return false;}
alert("Names:\n"+names); alert("Passwords\n"+passwords)
alert("# of names = "+names.length); alert("# of passwords = "+passwords.length)
name = prompt("Please enter your name");
password = prompt("Please enter your password");
for (i=0; i<names.length; i++) {
if(name == names[i]) {nameSW = true; break}
}
if (password == passwords[i]) passwordSW = true
if (nameSW && passwordSW) location.href = "YOUR PAGE HERE"
else location.href = "http://www.google.com"
}
// End -->
</script>
</head>

<body onLoad="getUser()">


</body>
</html>

CODE

/*
Title this page passList.js
*/
// begin
names = new Array()
names[0] = "USERNAME"
names[1] = "USERNAME"
names[2] = "USERNAME"
names[4] = "USERNAME"
names[5] = "USERNAME"
names[6] = "USERNAME"
names[7] = "USERNAME"
names[8] = "USERNAME"
names[9] = "USERNAME"

passwords = new Array()
passwords[0] = "PASSWORD"
passwords[1] = "PASSWORD"
passwords[2] = "PASSWORD"
passwords[3] = "PASSWORD"
passwords[4] = "PASSWORD"
passwords[5] = "PASSWORD"
passwords[6] = "PASSWORD"
passwords[7] = "PASSWORD"
passwords[8] = "PASSWORD"
passwords[9] = "PASSWORD"
// end


Tell me if this works, because I have no idea if it will or not, I only spent a few minutes writing it.
 

Posts in this topic


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: