You could assign the pages a session:
$_SESSION["page_visited"] = "xx.php";
All you'd have to do is use the session_start on the pages and then redirect to the relevant page:
Header('Location: www.yourwebpage.com'$_SESSION["page_visited"]);
$_SESSION["page_visited"] = "xx.php";
All you'd have to do is use the session_start on the pages and then redirect to the relevant page:
Header('Location: www.yourwebpage.com'$_SESSION["page_visited"]);