login and redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

login and redirect

Post by prue_ »

hello! can someone help me.. can you give me an idea.. I want to make a login page and redirects it to different web page depending on the username and password used in logging in... thanks!
Naeem
Forum Commoner
Posts: 31
Joined: Tue Jul 07, 2009 12:48 pm

Re: login and redirect

Post by Naeem »

Retrieve username and password from database authenticate it create session and then redirect it to desired page using

Code: Select all

header
function.
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: login and redirect

Post by prue_ »

thanks Naeem.. I actually have the code already.. but for a single username and password only and it also redirects to a certain page.. but I need several usernames and passwords for example:

username: uname1
password:pass1
redirect to :www.subdomain1.domain.com


username: uname2
password:pass2
redirect to :www.subdomain2.domain.com

username: uname3
password:pass3
redirect to :www.subdomain3.domain.com

thanks!
Naeem
Forum Commoner
Posts: 31
Joined: Tue Jul 07, 2009 12:48 pm

Re: login and redirect

Post by Naeem »

Then i thing you have to apply conditions for each user
like if username = this then redirect it to this page.....
Or add a one more field in database like domain name and automatically assing a domain to each user when registering
Hope this help and sorry for late reply:)
prue_
Forum Commoner
Posts: 64
Joined: Thu May 07, 2009 10:34 pm

Re: login and redirect

Post by prue_ »

thanks! but I don't have a database.. I'm thinking of using .htaccess

Code: Select all

 
AuthUserFile .htpasswd
AuthName ByPassword
AuthType Basic
 
order deny, allow
deny from all
allow from .subdomain.domain.com
require valid-user 
 
but can I use several .htpasswd.. like if this uname and pass deny all and allow this subdomain (eg)
if matched uname1 and password1 from .htpasswd
deny all and allow subdomain1.domain.com

if matched uname2 and password2 from .htpasswd
deny all and allow subdomain2.domain.com

ans so on

do you have an idea with this? thanks again
Post Reply