This is what I have in mind:
1.they enter nologin.domain.com
2. nologin.domain.com registers a hardcoded username session var
3. nologin.domain.com forwards them using header() to members.domain.com
Here is the code:
nologin index:
Code: Select all
<?php
function auto_login($user)
{
session_register('user');
$_SESSION['user'] = $user;
}
session_start();
auto_login('business');
header("Location: http://members.domain.com");
?>Code: Select all
<?php
#Simply determines if session exists & leaves action to page calling it.
function session_check()
{
if(session_is_registered('user'))
{
$loggedin++;
}
return $loggedin;
}
#If no session, login form is dsplayed.
if(!session_check())
{
show form;
}
?>Code: Select all
<?php
if(session_is_registered('user'))
if(isset($_SESSION['user']))
if($_SESSION['user'])
?>The pattern goes like this:
1. First time I enter url nologin.domain.com it does not work. It forwards to the right page, but the session var is not sent.
2. It works the second time I enter the url.
It is as if the page does not recognize the session var until after it shows the form. I do set the var before I check for it & show the form though.
Anybody have any ideas?