Page 1 of 1

login and redirect

Posted: Mon Oct 26, 2009 1:18 am
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!

Re: login and redirect

Posted: Mon Oct 26, 2009 1:23 am
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.

Re: login and redirect

Posted: Mon Oct 26, 2009 1:44 am
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!

Re: login and redirect

Posted: Mon Oct 26, 2009 9:07 am
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:)

Re: login and redirect

Posted: Mon Oct 26, 2009 9:37 pm
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