Jump to content
MakeWebGames

Voting Incentive


Jigsaw

Recommended Posts

Thanks to Dominion for the voting mod, which I've set up, and it works great!

But I'm having trouble understand how Inventive setup works, I've looked on top 100 arena (http://www.top100arena.com/incentive.asp)

and saw this:

 

<?php
//////// Example Post-Back Script for Top 100 Arena

// include database connection here

// this is the variable we pass back to you that
// contains the value you passed to us with the vote link
$user = mysql_escape_string($_GET['postback']);

// check if the user has voted
$check_voted = mysql_fetch_array(mysql_query("SELECT vote FROM users WHERE username = '$user'"));
if ($check_voted[0] == 0) { // if they haven't voted
   // credit the user for voting, like giving +100 money as in the example
   mysql_query("UPDATE users SET money = money + 100, vote = '1' WHERE username = '$user'");
}
?>

 

Would this be what I add to voted.php or a seperate file?

 

<?php
//////// Example Post-Back Script for Top 100 Arena

require "lib/basic_error_handler.php";
set_error_handler('error_php');
include "config.php";
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
require_once('global_func.php');
$db = new database;
$db->configure($_CONFIG['hostname'], $_CONFIG['username'],
       $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT *
                    FROM `settings`");
while ($r = $db->fetch_row($settq))
{
   $set[$r['conf_name']] = $r['conf_value'];
}

// this is the variable we pass back to you that
// contains the value you passed to us with the vote link
$userid = mysql_escape_string($_GET['ID']);

// check if the user has voted
$check_voted = mysql_fetch_array(mysql_query("SELECT vote FROM users WHERE username = '$userid'"));
if ($check_voted[0] == 0) { // if they haven't voted
   // credit the user for voting, like giving +100 money as in the example
   mysql_query("UPDATE users SET money = money + 100, vote = '1' WHERE username = '$userid'");
}
?>

 

Thank you for the help

Link to comment
Share on other sites

I believe you give the site a postback url that they hit when a user from your site votes. So in your example you would give them the url of http://www.yoursite.com/votingpage.php?ID=

 

You tell them what to send back to you but what I would do is also provide them with the ID of Top 100 in your database, this way you can have one script for all. So for example you would do:

http://www.yoursite.com/votingpage.php?site=2&ID=. You just change the 2 to the number they are in your sites table.

 

The problem with this script is that you have to get fancy because some sites like Top 100 Arena require a special get key like "incentive" to be passed to them so they know to send data back to you.

Link to comment
Share on other sites

Still abit confused, so I have the following files

voting.php (what the users access to vote)

voted.php (the page that the voting link redirects to before the the actual voting site so the credit is made)

So I'm guessing I should put the example code in the voted.php (where users get credited)?

and then i would use this url as the "postback":

www.mygameURL.com/voted.php?ID=$userid or {$r['userid']}

Sorry still learning! Thanks

Link to comment
Share on other sites

Still abit confused, so I have the following files

voting.php (what the users access to vote)

voted.php (the page that the voting link redirects to before the the actual voting site so the credit is made)

So I'm guessing I should put the example code in the voted.php (where users get credited)?

and then i would use this url as the "postback":

www.mygameURL.com/voted.php?ID=$userid or {$r['userid']}

Sorry still learning! Thanks

ill use top 100 for this example (http://www.top100arena.com/)

to set up for them would be http://www.top100arena.com/in.asp?id=xxx&incentive=1000

 

xxx being your special game id or name depends on the voting site really and incentive being the users id

In the website that offers the incentive voting it will ask you for a call back url which would be your game url/voted.php

inside this file you would then need to secure the $_GET['postback'] and then scan the users table to make sure the user is real using the post back if true then scan to check if they voted if not reward them and if voted already script does nothing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...