Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2012, 07:36 PM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 32,177
Aasixx is on a distinguished road
Default PHP Code.

Well, I'm using Derpstra's wonderful PHP code (thank you for posting it, Derpstra!) and I was wondering if there was a way to make it where you cannot refresh that page or go back. I'm using this page for when they purchase a certain amount of cash for real money that they're sent to this page to automatically gain their purchased cash. But, I noticed, when you refresh/press go back, they can easily cheat and gain a lot of cash for free. I want to make it where they cannot cheat. Is this possible?

Code:
PHP Code:
<?php

include("functions/functions.php");
include(
"functions/functions_users.php");
include(
"functions/functions_adopts.php");
include(
"functions/functions_friends.php");
include(
"functions/functions_items.php");
include(
"inc/lang.php");
include(
"inc/bbcode.php");

//***************//
// START SCRIPT //
//***************//

$cashname grabanysetting("cost");
$reward1;

if(
$isloggedin == "yes"){
changecash($reward$GLOBALS['username'], $GLOBALS['money']);
$article_title "Hello, {$username}!";
$article_content "You have gained {$reward} {$cashname}.";
}
else{
$article_title "You are not logged in!";
$article_content "You must be logged in to view this page!";
}

//***************//
// OUTPUT PAGE //
//***************//

echo showpage($article_title$article_content$date);
?>
__________________
Reply With Quote
  #2  
Old 08-30-2012, 05: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: 491,392
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
  #3  
Old 09-17-2012, 06:15 PM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 32,177
Aasixx is on a distinguished road
Default

Awesome, thanks again HoF!
__________________

Last edited by Aasixx; 09-17-2012 at 06:37 PM.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for someone to code for me :) Infernette Staff Central 33 02-03-2014 05:44 PM
Could some one code this..? Abronsyth Questions and Supports 5 04-13-2012 08:27 PM
Invite Code/Alpha Code Shex Questions and Supports 0 03-07-2011 05:08 AM
I need a simple code Cosma Questions and Supports 2 01-26-2010 05:55 AM
Need a code to vote Cosma Questions and Supports 0 01-25-2010 05:24 PM


All times are GMT -5. The time now is 09:02 AM.

Currently Active Users: 662 (0 members and 662 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636