[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Password and user id determines place to go

Is there a way to have a file that has the users id and password and their personal page, so that when they enter their password and id, it takes them to that page?
What I'm trying to do is have the user log in with their password and it take them to their personal page, but I also have another part that allows me to add and remove their passwd and id's straight from the web. I can do one or the other, but not both at the same time. Can anyone help?
0
kelliwork
Asked:
kelliwork
1 Solution
 
BrainMasterCommented:
sounds doable... not sure what system or what kinda cgi you would want but here's a my first thought about how I would do it...

use .htaccess to ask for user/pass and when accepted load a page with would do a redirect to there correct page bassed on the username. If you enter your username goto your page which would have a "change usernames and passes" link to a page that allows those changes.

One problem is that I'm not sure what would happen if you tried to edit the .htaccess and password file directly from the script. might cause problems if someone accessed that web at that exact time so you might have to handle the asking for the username and pass in a form and the script having it's own user/pass file(s).

questions: what cgi scripting do you want to use? perl? shell script? c++? dos batch? ;)

I just play with cgi myself and have very little load on my server so I'm not sure what kinda problems you would have if lots of people try to access at the same time with the above ideas,
0
 
KennyIT Application ExecutiveCommented:
If you do it that way, what is there to stop someone from keying in another person's username file in the location box of the brower?

e.g. I key-in www.domain.com\kelliwork.htm, it would open your html file. Just a thought.
0
 
BrainMasterCommented:
well the .htaccess would not allow that.
if .htaccess was in the www.domain.com\users\ directory and don right, you can't access any page, even directly, without using user/pass.

As for uring user/pass via form can be done fully via cgi. So the url will always look like www.domain.com\cgi-bin\users.pl
0
 
jhurstCommented:
I am assuming that you know how to generate the form that asks for the user name and password.

Now, just have a perl script that opens a file containing the user names and passwords, I would use something like:

dbmopen(users,"users",0644); #the hash with user name as key and
                 #password as the value
if ($users{$usernameEntered} eq $passwordEntered) #if matches
  {$file2open=$usernameEntered . ".lmth"} #then page is his name
else
  {$file2open="noSuch.html"} #otherwise error
open(FILE,$file2open); #open what we want to send to him
print "Content-type: text/html\n\n"; #so the server knows to send

while (<FILE>) {print} #copy the page to the user
close (FILE); #we copied it
dbmclose(users); #we are done with the file

Note, I named the pages with the username.lmth not html, I did this so that a knoweledgeable user can not just enter the url knowing the user name and get there without entering the user name and password.

Now, you just make a little editor to allow you to add users to the file.
0
 
kelliworkAuthor Commented:
Thanks for your help.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now