You can use PHP sessions to achieve this. It displays a message saying 'Session Expired' if they click the back or forward button on a page they have already visited.
First of all, you need to define the session var in the purchase page, it should look like this below:
PHP Code:
// In your cash purchase page.
$_SESSION['reward'] = 1;
Then unset the session in the money acquisition page:
PHP Code:
// In your actual money reward page
if($isloggedin == "yes" and isset($_SESSION['reward'])){
changecash($reward, $GLOBALS['username'], $GLOBALS['money']);
$article_title = "Hello, {$username}!";
$article_content = "You have gained {$reward} {$cashname}.";
unset($_SESSION['reward']);
}
elseif($isloggedin == "yes" and empty($_SESSION['reward'])){
$article_title = "An error has occurred";
$article_content = "The last session has expired, please return to the previous page.";
}
else{
$article_title = "You are not logged in!";
$article_content = "You must be logged in to view this page!";
}