Several weeks ago, we released the affiliate MrWQ option. With it, you could refer users to and earn money from the site.
Several game owners have some decent success with this option, but they just weren't satisfied...
I've been asked (by several different owners) to integrate MrWQ with McCodes, so that users never have to leave their site.
Thus, that is what we did.
Simply run some sql, upload 4 files, and register an account on MrWQ.com (doesn't require admin approval, takes less than a minute) and you are up and running.
With this mod, users are given the option to take a quiz, take a survey, or play a quick game and earn in-game bonuses (cash, crystals, or items). For every offer they complete, you earn cash (which you can keep track of on the stats page).
Everything is automated - when they complete it, a postback is sent from the advertiser to our server. In turn, we send a postback to your server to the script you uploaded, which rewards the user according to your specifications.
An admin panel has been built in as well.
Here, just take a look at the screenies:
Admin Interface:


User Interface:

As you can see, it's fairly simple.
Moreover, it's free to get started / install!
You can see how it works here:
http://seanybob.net/mccodesv2(Just click the EARN link next to crystals)
Or just simply download the mod here:
http://seanybob.net/mods/download/McCodeMrWQIntegrationMod.zipand follow the instructions in the read me. You'll be set up within 5 minutes.
Users posting free codes should post the full code, with installation instruction.
Posting a link to a .rar or any other file located anywhere else, will be removed permanently, and a warning will be issued.
In accordance with the rules, I'll post the full code here too. I realize possibly leaving the link above may be against the rules, but since there are about 6 files involved it just makes it easier - feel free to download and check, those files will be exactly what I post below.
ReadMe.txt
Hey there!
Thank you for downloading the SB Mccode/MRWQ Game Integration script.
To install, you first need to go to MrWQ.com and register an account.
Login at MrWQ.com, and click Preferences (left hand side, halfway down).
Click Affiliate Postback URL Change (For game owners only).
Change your Affiliate Postback Url.
If your game is located at mccodesgame.com,
then your affiliate postback url would be http://mccodesgame.com/zzz_mrwqpostback.php
While you're there, change your Affiliate Postback Password as well.
Write down both the password you set here, and your Affiliate ID number.
Open up zzz_mrwqpostback.php and edit the line that says:
//Affiliate Postback Password
$password='this-is-where-your-password-goes';
Put in your password you just created.
Open up zzz_mrwqaff.php and edit the line that says:
//Affiliate ID
$affid=1;
Put in your affiliate ID number you wrote down (in place of the 1).
Now, you are ready to set up the mod.
Run the sql in sql.txt in phpmyadmin.
Then, upload the files from the upload folder into the game directory on your server.
The mod is now installed and running properly!
All you have to do now is create links.
The two admin pages are
zzz_mrwqrewardsadmin.php
zzz_mrwqstatsadmin.php
Add links to these somewhere in your admin menu.
On your browser, visit http://yourgame.com/zzz_mrwqrewardsadmin.php
and add rewards for the three different types of offers. By default, I would suggest giving a cash
reward on one, a crystal reward on one, and an item reward on the third, but this is up to you.
The page that your members need to see is
zzz_mrwqaff.php
Add a link on your donator page, make an announcement, post the link in the forms, etc.
Some people even altered header.php, and added an [EARN] link next to where it displays how many crystals
each user has.
After you have followed the above guide, you are done!
Everything from here on out is automated. Be sure to check your earnings every now and then
in the zzz_mrwqstatsadmin.php page, and cash out whenever you feel like it with the account
you made on MrWQ.com (minimum cashout is $10).
If you have any questions or need any help setting it up, feel free to shoot me an email
Seanybob@gmail.com
Thanks,
Seanybob
sql.txt
CREATE TABLE IF NOT EXISTS `zzz_mrwqpb` (
`id` int(11) NOT NULL auto_increment,
`ip` varchar(255) NOT NULL,
`userid` int(11) NOT NULL,
`offertype` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `zzz_mrwqrewards` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`crystals` int(11) NOT NULL,
`money` int(11) NOT NULL,
`itemid` int(11) NOT NULL,
`offertype` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `zzz_mrwqstats` (
`offersdone` int(11) NOT NULL,
`profit` decimal(11,2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `zzz_mrwqstats` (`offersdone`, `profit`) VALUES
(0, '0.00');zzz_mrwqpostback.php
<?php
//Affiliate Postback Password
$password='this-is-where-your-password-goes';
include "config.php";
include "global_func.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
$userid=abs((int)$_POST['userid']);
$profit=abs($_POST['profit']);
$type = mysql_real_escape_string($_POST['type']);
if($_POST['password']!=$password){die("bad");}
$db->query("INSERT INTO zzz_mrwqpb (ip, userid, offertype) VALUES('$IP', $userid, '$type')");
$rew=$db->query("SELECT * FROM zzz_mrwqrewards WHERE offertype='$type'");
$totmoney=0;
$totcrystals=0;
$totitems=0;
while($rwd=$db->fetch_row($rew))
{
$db->query("UPDATE users SET money=money+{$rwd['money']},crystals=crystals+{$rwd['crystals']} WHERE userid=$userid");
$totmoney+=$rwd['money'];
$totcrystals+=$rwd['crystals'];
if($rwd['itemid']>0)
{
item_add($userid, $rwd['itemid'], 1);
$totitems++;
}
}
$text="You just received a reward, ";
if($totmoney>0){$text.="\$$totmoney, ";}
if($totcrystals>0){$text.="$totcrystals crystals, ";}
if($totitems>0){$text.="$totitems item(s), ";}
$text.=" for completing an offer.";
event_add($userid,$text);
$db->query("UPDATE zzz_mrwqstats SET offersdone=offersdone+1,profit=profit+$profit");
?>
zzz_mrwqrewardsadmin.php
<?php
include "globals.php";
if($ir['user_level']!=2){die();}
print"<h2>MrWQ Affiliate Admin Interface</h2>";
print"
<font size=2><b>How much you make per offer:</b>
<br />Quizzes: \$0.50-\$0.75 each
<br />Games: \$0.65-\$0.75 each
<br />Surveys: \$0.45-\$1.50 each
</font><br /><br />";
$delid=abs((int)$_GET['delid']);
if($delid>0)
{
$db->query("DELETE FROM zzz_mrwqrewards WHERE id=$delid");
print"<font color=red>Reward Deleted</font><br /><br />";
}
print"<table class='table'><tr><th>Name/Type</th><th>Reward</th><th>Delete</th></tr>";
$rstf=$db->query("SELECT * FROM zzz_mrwqrewards ORDER BY offertype");
while($rst=$db->fetch_row($rstf))
{
$rewards='';
if($rst['name']){$name=$rst['name']."<br />(".$rst['offertype'].")";}
else{$name=$rst['offertype'];}
if($rst['crystals']>0){$rewards.="{$rst['crystals']} crystals<br />";}
if($rst['money']>0){$rewards.="\${$rst['money']}<br />";}
if($rst['itemid']>0)
{
$iname=$db->fetch_row($db->query("SELECT itmname FROM items WHERE itmid={$rst['itemid']}"));
$rewards.="{$iname['itmname']}<br />";
}
print"<tr><td>$name</td><td>$rewards</td>
<td>><a href=?delid={$rst['id']}>Delete</a></td>";
}
print"</table><br /><br />";
$rname=mysql_real_escape_string($_POST['rname']);
$crystals=abs((int)$_POST['crystals']);
$money=abs((int)$_POST['money']);
$itemid=abs((int)$_POST['itemid']);
$type=mysql_real_escape_string($_POST['type']);
if(($crystals || $money || $itemid) && $type)
{
$db->query("INSERT INTO zzz_mrwqrewards (name, crystals, money, itemid, offertype) VALUES('$rname', $crystals, $money, $itemid, '$type')");
print"Reward Added.<br />><a href=?no=1>Back</a>";
}
else
{
print"<table class='table'><tr><th colspan=2>Create New Reward</th></tr>
<form method=post action=?submit=1>
<tr><td>Crystals: </td><td><input type=text name=crystals value=0></td></tr>
<tr><td>Money: </td><td><input type=text name=money value=0></td></tr>
<tr><td>Item ID<br />(Leave blank for none): </td><td><input type=text name=itemid></td></tr>
<tr><td>For which type of offer: </td><td><select name=type>
<option value='survey'>Survey</option>
<option value='game'>Game</option>
<option value='quiz'>Quiz</option>
</select>
<br /></td></tr>
<tr><td colspan=2 align=center><input type=submit value=Submit></td></tr>
</form>
</table>
";
}
print"<br /><br /><br />Note-User will receive every reward for the type specified. <br />Thus, if a user completes a quiz, they will receive every reward that has the type 'quiz'.";
$h->endpage();
?>
zzz_mrwqaff.php
<?php
//Affiliate ID
$affid=1;
include "globals.php";
print "
<h3>Want To Get A Boost In The Game?</h3>";
print"<table class='table' width=80%>";
print"<tr><th align=center>Offer Type</th><th align=center width=20%>Rewards</th></tr>";
$off3=$db->query("SELECT * FROM zzz_mrwqrewards WHERE offertype='quiz'");
print"<tr><td align=center><br /><b>Quiz</b><br /><font size=1>
Take a quiz on a random topic! After answering the questions, pass through several pages of offers. You can just click skip/no on all them if you'd like. Continue until you see your score.<br />
</font><br />><a href=http://mrwq.com/outaff.php?affuid=$affid&uid={$ir['userid']}&offertype=quiz><font color=green>I want to do this one!</font></a>
</td><td align=center>";
$totmoney=0;
$totcrystals=0;
$totitems="";
while($of3=$db->fetch_row($off3))
{
$totmoney+=$of3['money'];
$totcrystals+=$of3['crystals'];
if($of3['itemid']>0)
{
$iname=$db->fetch_row($db->query("SELECT itmname FROM items WHERE itmid={$of3['itemid']}"));
$totitems.="{$iname['itmname']}<br />";
}
}
if($totmoney>0){$text.="\$$totmoney <br />";}
if($totcrystals>0){$text.="$totcrystals crystals <br />";}
if($totitems){$text.="$totitems <br />";}
print$text;
print"</td></tr>";
$text="";
$off2=$db->query("SELECT * FROM zzz_mrwqrewards WHERE offertype='game'");
print"<tr><td align=center><br /><b>Game</b><br /><font size=1>
Play a simple, random game! After answering the questions, pass through several pages of offers. You can just click skip/no on all them if you'd like. Continue until you see your score.<br />
</font><br />><a href=http://mrwq.com/outaff.php?affuid=$affid&uid={$ir['userid']}&offertype=game><font color=green>I want to do this one!</font></a>
</td><td align=center>";
$totmoney=0;
$totcrystals=0;
$totitems="";
while($of2=$db->fetch_row($off2))
{
$totmoney+=$of2['money'];
$totcrystals+=$of2['crystals'];
if($of2['itemid']>0)
{
$iname=$db->fetch_row($db->query("SELECT itmname FROM items WHERE itmid={$of2['itemid']}"));
$totitems.="{$iname['itmname']}<br />";
}
}
if($totmoney>0){$text.="\$$totmoney <br />";}
if($totcrystals>0){$text.="$totcrystals crystals <br />";}
if($totitems){$text.="$totitems <br />";}
print$text;
print"</td></tr>";
$text="";
$off1=$db->query("SELECT * FROM zzz_mrwqrewards WHERE offertype='survey'");
print"<tr align=center><td><br /><b>Survey</b><br /><font size=1>
Take a survey about yourself! After completing the survey, continue through all their questions/offers (you can click skip/no as much as you want) until you reach the last steps page, where you must click at least 2 silver offers (but don't have to complete them)<br />
</font><br />><a href=http://mrwq.com/outaff.php?affuid=$affid&uid={$ir['userid']}&offertype=survey><font color=green>I want to do this one!</font></a>
</td><td align=center>";
$totmoney=0;
$totcrystals=0;
$totitems="";
while($of1=$db->fetch_row($off1))
{
$totmoney+=$of1['money'];
$totcrystals+=$of1['crystals'];
if($of1['itemid']>0)
{
$iname=$db->fetch_row($db->query("SELECT itmname FROM items WHERE itmid={$of1['itemid']}"));
$totitems.="{$iname['itmname']}<br />";
}
}
if($totmoney>0){$text.="- \$$totmoney <br />";}
if($totcrystals>0){$text.="- $totcrystals crystals <br />";}
if($totitems){$text.="- $totitems <br />";}
print $text;
print"</td></tr>";
print"</table>";
$h->endpage();
?>
zzz_mrwqstatsadmin.php
<?php
include "globals.php";
if($ir['user_level']!=2){die();}
print"<h2>MrWQ Affiliate Stats</h2>";
$sin=$db->fetch_row($db->query("SELECT * FROM zzz_mrwqstats LIMIT 1"));
print"<table class='table'>
<tr><th>Total Offers Done</th><th>Profit</th></tr>
<tr><td align=center>{$sin['offersdone']}</td><td align=center>\${$sin['profit']}</td></tr>
</table><br /><br />";
print"<table class='table'>
<tr><th colspan=2>Last 10 Offers Done</th></tr>";
$sinf=$db->query("SELECT * FROM zzz_mrwqpb LIMIT 10");
while($sin2=$db->fetch_row($sinf))
{
$unm="";
$unm=$db->fetch_row($db->query("SELECT username FROM users WHERE userid={$sin2['userid']}"));
print "<tr><td align=center>{$unm['username']}</td><td align=center>{$sin2['offertype']}</td></tr>";
}
print"</table><br /><br />Note - When your profit is equal to or greater than $15, simply go to MrWQ.com, log into the account you made, and submit a cashout request to receive your money.";
$h->endpage();
?>