Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Viewing a Page Adds and/or Takes Away Money (http://www.mysidiaadoptables.com/forum/showthread.php?t=3792)

Blizzard 08-04-2012 01:56 PM

Viewing a Page Adds and/or Takes Away Money
 
First of all, I am really sorry if someone already asked this, I looked and couldn't find anything.

How can you make it so when a player views a page, a certain amount of their money is taken away or added?

I am really new to coding and trying to figure everything out. Thanks it advance. :)

Derpstra 08-18-2012 11:28 AM

I'm not sure if you already got an answer to this since yet since you posted this question awhile ago, but since there are no replies yet, I'll give you the most basic script I can think of.

Quote:

<?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");
$reward= 1;

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);
?>
To change how much money they receive, just change the number after "$reward". :)

Blizzard 08-21-2012 09:06 AM

Thank you so much. :)

Hall of Famer 08-23-2012 09:31 AM

Well I'd say use $loggedinname instead of $GLOBALS['username'] if you can. The superglobal arrays are both insecure and slow, I've actually gotten rid of all of them in the next release. It is convenient to use though, which is why we used to be doing it this way.

Blizzard 08-25-2012 09:23 AM

Alright! Thanks :)


All times are GMT -5. The time now is 12:21 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.