basic: getting current URL
| From: | Sam Folk-Williams | Date: | Tue, 06 May 2003 02:26:37 +0000 |
| Subject: | basic: getting current URL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146485@lists.php.net to get a copy of this message | ||
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();
}