Warptweet Posted March 19, 2007 Share Posted March 19, 2007 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 More sharing options...
conker87 Posted March 19, 2007 Share Posted March 19, 2007 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 } Link to comment https://forums.phpfreaks.com/topic/43406-solved-check-what-previous-page-was/#findComment-210814 Share on other sites More sharing options...
Warptweet Posted March 19, 2007 Author Share Posted March 19, 2007 I hope so, thanks. Link to comment https://forums.phpfreaks.com/topic/43406-solved-check-what-previous-page-was/#findComment-210841 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.