Hi, 

I found one of my problems and also implemented your suggestions, and
still the same thing. It will not redirect. 

The problem I found is that $_SERVER['SERVER_NAME'] does not include the
port number. On my Win PC I am using port 800. So I changed this line
to:

$_SESSION['goto'] = "http://"; . $_SERVER['SERVER_NAME'] .":800" .
$_SERVER['REQUEST_URI'];

If I take the output from that and put it into my browser is works just
fine, but it will not work in the script.

This is the portion of the script in question now after I implemented
your changes.

                session_start();
                      
            $_SESSION['logged'] = "True";
            $_SESSION['user'] = $row['user'];
                        
            header("Location: " . $_SESSION['goto']);

If I echo $_SESSION['goto'] right after session_start() it shows exactly
what it should be. So I am at a loss.

Ideas??

-----Original Message-----
From: Ray Hunter [mailto:[EMAIL PROTECTED] 
Sent: July 22, 2003 10:47 PM
To: Beauford.2005
Subject: Re: [PHP] Re: Redirection Question (I spoke to soon)


Try doing:

session_start();
$_SESSION['logged']     = "True";
$_SESSION['user']       = $row['user'];

// you cant do this here.
// session_unregister('goto');
                        
header( "Location: ".$_SESSION['goto'] );


That should work.


--
BigDog


On Wed, 2003-07-23 at 19:35, Beauford.2005 wrote:
> Sorry all, apparently this doesn't work on either Windows or Linux. 
> Again, I thought it was working and once I got farther along I see 
> that it really wasn't. Basically what I get after I login is an empty 
> screen. Here is what I have :
> 
> This is the script that runs to see if the user is logged in.
> 
> session_start();
> if(!$_SESSION['logged']) {
> 
>       session_register('goto');
>       $_SESSION['goto'] = "http://"; . $_SERVER['SERVER_NAME'] . 
> $_SERVER['REQUEST_URI'];
> 
>       $url = "http://www.mysite.org/login/login.php";;
>       header("Location: $url");
> }
> 
> The above works and redirects me to the login page and has the right 
> referring page as shown below.
> 
> goto|s:59:"http://www.mysite.org/setup/inputs.php";;
> 
> This is in my login.php script. After I verify the user login is 
> correct, this piece of code is executed.
> 
>               session_start();
>             session_register('logged');
>             session_register('user');
>                         
>             $_SESSION['logged'] = "True";
>             $_SESSION['user'] = $row['user'];
>                         
>             $target = "Location: " . $_SESSION['goto'];
> 
>             session_unregister('goto');
>                         
>             header($target);
> 
> What I get after this is a blank page. The user has been logged in and

> shows in the session file, but it just isn't redirecting.
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to