Zubrag.com
July 21, 2018, 09:09:17 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: password protect: redirect after login  (Read 8248 times)
newboy
Newbie
*
Posts: 2


« on: January 12, 2007, 04:42:17 PM »

hi , I'm newboy

I would like to do the following.

start with my login page and then redirect the user, according to their pre defined password and pre defined subdomain to that location.

Is it possible to use password protect to do that ?

It is the redirect part that I am struggling with.

e.g.

password would be john
subdomain would be johnsite     

could I write $subdomain=johnsite

I then wondered if I could add the variable and then tell the web page to redirect it to www.$subdomain.mysite.com

the aim as I said is to redirect john to his sub domain and then the next user to their one.

On each sub domain they would then see different things.
However as they move between the pages of their sub domain I won't want any further log in or passwords.

can any of you help ??

Logged
zubrag
Administrator
Hero Member
*****
Posts: 787


WWW
« Reply #1 on: January 13, 2007, 05:21:16 AM »

If you want to redirect to subdomain entered as login then add following code just before the ?> line at the end of the script
header('Location: http://www.'.$login.'.mysite.com'); die();

so it would look like
header('Location: http://www.'.$login.'.mysite.com'); die();
?>
Logged
newboy
Newbie
*
Posts: 2


« Reply #2 on: January 13, 2007, 03:21:31 PM »

thanks to zubrag for answering my thread.

The question I have as I am newboy, is now how to include the information for the redirect.

for the sake of this example, let's say my subdomain is called  johnsite (as per previous post)

the information I would like to include in each of the different users that are allowed into the protected area is

user name - e.g. CDcollector

password - e.g. john

subdomain - e.g. johnsite   (a subdomain of www.mysite.com - so that'd be www.johnsite.mysite.com)


I read the post that was a relpy and now have two questions

question one,

where in the script and exactly how do I tell it that the name of the subdomain to redirect to ?

Second question

I seem to be only getting an input  box for the password and not for the user name ? (using the downloaded version)

what have I done wrong ?

I am sorry to be so slow but I am so very new to php (and mysql.)

Many thanks for any more help you can give me. (please give me the very slow step by step newboy's guide !)

regards

newboy

 Huh
Logged
zubrag
Administrator
Hero Member
*****
Posts: 787


WWW
« Reply #3 on: January 14, 2007, 11:38:09 AM »

I seem to be only getting an input  box for the password and not for the user name

Script shows login/password or password only box depending on the following option:

// request login? true - show login and password boxes, false - password box only
define('USE_USERNAME', true);

In order to redirect to custom subdomain add array of user => subdomain below the array holding passwords. So you should have something like:

##################################################################
#  SETTINGS START
##################################################################

// Add login/password pairs below, like described above
// NOTE: all rows except last must have comma "," at the end of line
$LOGIN_INFORMATION = array(
  'user1' => 'user1-password',
  'admin' => 'admin-password'
);

$SUBDOMAINS = array(
  'user1' => 'subdomain1',
  'admin' => 'subdomain123'
);

// request login? true - show login and password boxes, false - password box only
define('USE_USERNAME', true);

##################################################################
#  SETTINGS END
##################################################################

Than add following at the very bottom of the script, just before the ?> line:

header('Location: http://www.'.$SUBDOMAINS[$login].'.mysite.com'); die();
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC