Thread: PHP Code.
View Single Post
  #2  
Old 08-30-2012, 04:52 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 397,992
Hall of Famer is on a distinguished road
Default

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!"

__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote