Menu

WGD Features
Articles and Reviews
Showcase
Link to Us!
Write for Us!

WGD Resources
Blogs
Help
Polls
Search
Tools

WGD Community
Forums
Online Chat

Pages: [1]   Go Down
  Print  
Author Topic: Reward Script Tutorial for TopRPGGames  (Read 929 times)
sidneycat
WGD Enhanced
Jr. Member
*
Offline Offline

United Kingdom United Kingdom

Posts: 79


Powerful powerful Busker


WWW
« on: June 20, 2007, 05:45:18 AM »

In addition to TWG, you can also signup for TopRPGGames (TRG) as they offer the same service. The more rankings websites you signup for, the more free exposure you will have for your game Smiley

Here is a script I use on my game which processes votes from TRG:

Code:
<?php
include "mysql.php";
global 
$c;
if(
$_GET['dshfsf']=sdjfdhskfds)
{
$userid=abs((int) $_POST['userid']);
$q=mysql_query("SELECT * FROM votes WHERE userid=$userid AND list='trg'",$c);
if(
mysql_num_rows($q))
{
mysql_query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'You have already voted at TRG today.')",$c);
die;
}
else
{
mysql_query("INSERT INTO votes values ($userid,'trg')",$c);
mysql_query("UPDATE users SET energy=energy+15 WHERE userid=$userid",$c);
mysql_query("UPDATE users SET energy=100 WHERE energy>100 and userid=$userid",$c);
mysql_query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'You have recieved 15 energy for voting at TopRPGGames - thank you!')",$c);
exit;
}
}
?>

Notice the 'if($_GET['dshfsf']=sdjfdhskfds)'. This line serves so that if somebody does discover your file, they will not only have to figure out what variable is required (dshfsf) but also the value needed (sdjfdhskfds). There is no real chance anybody can do this Smiley

However you will have to put these variables onto the TRG website when you signup (ie. http://youramazinggame.com/trg.php?dshfsf=sdjfdhskfds)

One last difference - the users stats are updated and a note is also made in the table 'votes'. This means players cannot vote more than once per day to receive large bonuses. I can then setup my CRON to empty this table every day, so users can vote and receive their bonus (in this case, 15 extra energy/turns) just once a day.
Logged

Regards,
Sidneycat

http://buskerwars.com
Pages: [1]   Go Up
  Print  
 
Jump to:  

User
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 03, 2009, 10:51:29 PM

Login with username, password and session length

WGD Friends
Social Gamer.org
Crazyball Nexus
Sticky Feet

Recent
[December 07, 2008, 05:13:58 PM]

[July 09, 2008, 04:59:13 AM]

[July 04, 2008, 09:28:31 AM]

[July 04, 2008, 09:19:49 AM]

[July 04, 2008, 01:10:44 AM]

[July 02, 2008, 05:10:38 AM]

[July 02, 2008, 05:07:05 AM]

[June 30, 2008, 11:27:54 AM]

[June 30, 2008, 11:18:24 AM]

[June 30, 2008, 10:55:27 AM]

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks

TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!


Google visited last this page July 02, 2009, 03:43:22 PM