Jump to content

[SOLVED] Check What Previous Page Was?


Warptweet

Recommended Posts

I would use this code to check what the current page is.

 

$realname = basename($_SERVER[sCRIPT_FILENAME], ".php");

if ($realname == 'index.php?cmd=index')
{
   do stuff
}

 

But, instead of the current page, any ideas how I would use that (it can be different if neccessary) to check if the PREVIOUS page was 'index.php?cmd=index'?

Link to comment
https://forums.phpfreaks.com/topic/43406-solved-check-what-previous-page-was/
Share on other sites

I would use this code to check what the current page is.

 

$realname = basename($_SERVER[sCRIPT_FILENAME], ".php");

if ($realname == 'index.php?cmd=index')
{
   do stuff
}

 

But, instead of the current page, any ideas how I would use that (it can be different if neccessary) to check if the PREVIOUS page was 'index.php?cmd=index'?

Wouldn't $_SERVER['HTTP_REFERER']; work?

 

$realname = basename($_SERVER['HTTP_REFERER'], ".php");

if ($realname == 'index.php?cmd=index')
{
   do stuff
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.