RE: [PHP] basic: getting current URL
| From: | R'twick Niceorgaw | Date: | Tue, 06 May 2003 02:46:18 +0000 |
| Subject: | RE: [PHP] basic: getting current URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146486@lists.php.net to get a copy of this message | ||
Check in $_SERVER variable or $PHP_SELF
> -----Original Message-----
> From: Sam Folk-Williams [mailto:sfolkwilliams@mn.rr.com]
> Sent: Monday, May 05, 2003 10:27 PM
> To: php-general@lists.php.net
> Subject: [PHP] basic: getting current URL
>
>
> Hi,
>
> Is there a simple way to get the filename of the current
> page? I have a session test included at the top of each page
> that redirects the user to a login page if they are not
> logged in. I want to capture the URL they tried to access, so
> I can send them back there after they go to the login page
> and login. I think this should be simple, but I'm just not finding it.
>
> Thanks,
> Sam
> //get path of current page
> $current_url = HOW DO I GET THE PATH?
> // session check
> session_start();
> if (!session_is_registered("SESSION"))
> {
> // if session check fails, invoke error handler
> header("Location:
> http://www.site.com/index.php?from_page=>
> $current_url");
> exit();
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>