Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Vote Reward System

Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
First of all, execute this query in your "CabalCash" database:
Code:
CREATE TABLE VoteReward(
UserID VARCHAR(50) NULL,
VoteDate INT NULL
)

Then, download the "votereward.rar" in the attachments.

Place the files in the "modules" directory of your website (that is for it can include the adodb5 files properly. If you know php a little you can change the adodb5 include path in the vote_do.php file, but in cabaltoolz the path is correct when the files are put into the backend site "modules" directory)

Open vote_do.php and edit "$server, $user, $pass" variables accordingly to your db server, db username and db password.

Open "votereward.php" and modify the window.open link in the function 'vote()' to your xtremetop link, and modify the index page link as well.

Open "votereward.php" in your browser and enjoy!

Note: If someone can make a better design for votereward.php, I would appreciate it.

Usage

1. Click the link "Vote for us from here." and vote for the server.
2. Enter your CABAL Account Username and Password, and press "Receive Reward."

Everyone can receive reward once in every 12 Hours, and the reward is 1 CC.

If you find any bugs, post them here, I will do my best to fix them.
System works perfect on Microsoft Server 2003, and XAMPP WebServer.(PHP 5)
 

Attachments

You must be registered for see attachments list
Last edited:
Joined
Apr 12, 2007
Messages
426
Reaction score
251
WoW man such a great share!!!! :) im gonna test and report! :)

---------- Post added at 10:10 AM ---------- Previous post was at 09:29 AM ----------

Well tried to put in CabalToolz UserCP but it gives syntax error for this:
PHP:
function vote()
{
	createCookie('voted', 'yes', 720);
	window.open('http://xtremetoplink.com');
}

ideas? :?:
 
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
WoW man such a great share!!!! :) im gonna test and report! :)

---------- Post added at 10:10 AM ---------- Previous post was at 09:29 AM ----------

Well tried to put in CabalToolz UserCP but it gives syntax error for this:
PHP:
function vote()
{
	createCookie('voted', 'yes', 720);
	window.open('http://xtremetoplink.com');
}

ideas? :?:

Well it should not have any syntax errors, can you post the exact error here? (Do not try to put it in the user cp, put it in a seperate page, same function may already be in use)

The section of javascript should be like this:
Code:
<script type="text/javascript">
function createCookie(name,value,min) {
	if (min) {
		var date = new Date();
		date.setTime(date.getTime()+(min*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function reward()
{
var id=document.forms["vote"].elements[0].value;
var pwd=document.forms["vote"].elements[1].value;

if (window.XMLHttpRequest)
{
	xmlhttp=new XMLHttpRequest();
}
else
{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function ()
{
	if (xmlhttp.readyState==4 && xmlhttp.status==200)
	{
		document.getElementById("vote").innerHTML=xmlhttp.responseText;
	}
}
xmlhttp.open("GET", "vote_do.php?u="+id+"&p="+pwd, true);
xmlhttp.send();
}
function vote()
{
	createCookie('voted', 'yes', 720);
	window.open('http://xtremetoplink.com');
}
</script>

This gives no errors.
 
Joined
Apr 12, 2007
Messages
426
Reaction score
251
Well it should not have any syntax errors, can you post the exact error here? (Do not try to put it in the user cp, put it in a seperate page, same function may already be in use)

The section of javascript should be like this:
Code:
<script type="text/javascript">
function createCookie(name,value,min) {
    if (min) {
        var date = new Date();
        date.setTime(date.getTime()+(min*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}
function reward()
{
var id=document.forms["vote"].elements[0].value;
var pwd=document.forms["vote"].elements[1].value;

if (window.XMLHttpRequest)
{
    xmlhttp=new XMLHttpRequest();
}
else
{
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function ()
{
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
        document.getElementById("vote").innerHTML=xmlhttp.responseText;
    }
}
xmlhttp.open("GET", "vote_do.php?u="+id+"&p="+pwd, true);
xmlhttp.send();
}
function vote()
{
    createCookie('voted', 'yes', 720);
    window.open('http://xtremetoplink.com');
}
</script>
This gives no errors.
Well im not that good in php... but heres my code (i use the donation page from usercp for it)

PHP:
<?PHP

$script .='<script type="text/javascript">
function createCookie(name,value,min) {
    if (min) {
        var date = new Date();
        date.setTime(date.getTime()+(min*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}
function reward()
{
var id=document.forms["vote"].elements[0].value;
var pwd=document.forms["vote"].elements[1].value;

if (window.XMLHttpRequest)
{
    xmlhttp=new XMLHttpRequest();
}
else
{
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function ()
{
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
        document.getElementById("vote").innerHTML=xmlhttp.responseText;
    }
}
xmlhttp.open("GET", "vote_do.php?u="+id+"&p="+pwd, true);
xmlhttp.send();
}
function vote()
{
    createCookie('voted', 'yes', 720);
    window.open('http://xtremetoplink.com');
}
</script>';

$form .='<form id="vote">
In order to receive rewards, you must provide your Username and Password.<br />
Username: <input type="text" name="user" /><br />
Password: <input type="password" name="pass" /><br />
<input type="button" value="Receive Reward" onclick="reward()" />
</form>';

?>
 
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
Apparently you are not that good. Place backslashes (\) before the ' s in the script. Example:

Code:
function vote()
{
    createCookie(\'voted\', \'yes\', 720);
    window.open(\'http://xtremetoplink.com\');
}

Note: $script .='....the script.....';

The ' s around the script variable is equal to will not have backslashes before them.
 
Joined
Apr 12, 2007
Messages
426
Reaction score
251
Apparently you are not that good. Place backslashes (\) before the ' s in the script. Example:

Code:
function vote()
{
    createCookie(\'voted\', \'yes\', 720);
    window.open(\'http://xtremetoplink.com\');
}
Note: $script .='....the script.....';

The ' s around the script variable is equal to will not have backslashes before them.
Thanks for this!
How do we modify the reward? i mean to give more CC?
 
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
I did not add that option, but if you know PHP, find:
Code:
$newcash=$r2[4]+1;
in vote_do.php, (there are 2 of them) and make each one
Code:
$newcash=$r2[4]+(the cash number you want to add);

Edit: Oh, and search this query in vote_do.php (for new cash accounts):

Code:
mssql_query('INSERT INTO CashAccount (UserID, Cash, CashBonus) VALUES ("'.$u.'",1,0)');

Make it:

Code:
mssql_query('INSERT INTO CashAccount (UserID, Cash, CashBonus) VALUES ("'.$u.'",(the cash number you want to add),0)');
 
Last edited:
Newbie Spellweaver
Joined
Dec 4, 2010
Messages
40
Reaction score
3
I try using cabaltoolz
I put the "vote_do.php" in Backend/modules folder
and the "votereward.php" in frontend/modules folder.

when I login my account nothing happens when I click the "receive reward" button.
Is my procedure correct or not? I did already edited the IP, User and password of my database in vote_do.php, I also already created the VoteReward table in cabalcash
 
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
It does not work because you need to place both to the backend/modules folder xD
 
Joined
Apr 12, 2007
Messages
426
Reaction score
251
Note: If someone can make a better design for votereward.php, I would appreciate it.
Well its not that xtra thing but hope you guys like it!

You need to use both files to get fully working!
Extra's: I added the function to go back to Form if already voted or Wrong ID....etc...
Modified Reward to give 10 CC.
Receive Credits Button modified---> You dont need to vote and to receive credits 1 by 1... If you click Receive Credits you get the credits+it navigates to vote page(votelink)
Hey Millenial maybe you can ceck if everything is Ok with this!

Hope you like it! :thumbup:

Edit: Fixed version added :)
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
If you can fix the button and add the "vote" function elsewhere (because that is the function which should be issued when the user votes, not receives reward) it will be perfect. ;)

Edit:

1st Step: Find

Code:
Acnathon- Ragezone

Replace with

Code:
Achnaton- Ragezone<br />
You can vote for us from <a href="javascript:vote()">here</a>.

2nd Step: Find

Code:
onclick="reward();javascript:vote()"

Replace with

Code:
onclick="reward()"

Now all should be fine! :p
 
Last edited:
Joined
Apr 12, 2007
Messages
426
Reaction score
251
Ok But if you write your username and password the button makes both functions isnt that better?

BTW sure i can change it no prob :)

---------- Post added at 10:09 PM ---------- Previous post was at 10:05 PM ----------

Added function like this:
PHP:
onclick="reward();javascript:vote()"

Ok I change them...

---------- Post added at 10:19 PM ---------- Previous post was at 10:09 PM ----------

Fixed Version added!

---------- Post added at 10:30 PM ---------- Previous post was at 10:19 PM ----------

BTW the idea to use 2 function (onclick) its because that way the user no need to hit 2 times... :D and it works same as this but only with one Button
 
Last edited:
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
This is a Vote Reward System, not a Cash Giving System, so users must click the voting link and vote to receive the reward, allright? ^^
 
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
No you can't ;)
The Vote Reward time info is stored inside the VoteReward table. Now the system has Log Support, with IP and Username display.

I will upload it asap.

The only way to vote more times is to use different ID s, and it appears on the logs with the IP addresses, so you can ban them easily.
I did not add a check for it because it is so easy to change the IP address, and the check is unnecessary.
 
Last edited:
Joined
Oct 14, 2008
Messages
1,277
Reaction score
249
No you can't ;)
The Vote Reward time info is stored inside the VoteReward table. Now the system has Log Support, with IP and Username display.

I will upload it asap.

The only way to vote more times is to use different ID s, and it appears on the logs with the IP addresses, so you can ban them easily.
I did not add a check for it because it is so easy to change the IP address, and the check is unnecessary.

Well,how can i see the logs with the IP?
 
Newbie Spellweaver
Joined
Nov 7, 2010
Messages
40
Reaction score
30
I am uploading the system with the logs now.
You can find the logs in the backend dir/modules/voteLogs directory.
Each day has its specific log.

Edit: New system added to this post, not to the main post.

If you will use this system, you need to add a boolean variable ($_config["vote_status"]) to your config.php file and set the variable to true. So add this line to config.php:

PHP:
$_config["vote_status"]=true;

This variable allows you to turn on/off the vote reward system. For example, if XtremeTop100 is inaccessible, you can turn off your reward system by setting the boolean to false.

You can just use the vote_do.php to add log support, but I added votereward.php because it shows the user directly that the system is disabled. Otherwise, user types in the username and password, and then sees the system is disabled.
 

Attachments

You must be registered for see attachments list
Last edited:
Joined
Oct 14, 2008
Messages
1,277
Reaction score
249
I am uploading the system with the logs now.
You can find the logs in the backend dir/modules/voteLogs directory.
Each day has its specific log.

Edit: New system added to this post, not to the main post.

If you will use this system, you need to add a boolean variable ($_config["vote_status"]) to your config.php file and set the variable to true. So add this line to config.php:

PHP:
$_config["vote_status"]=true;

This variable allows you to turn on/off the vote reward system. For example, if XtremeTop100 is inaccessible, you can turn off your reward system by setting the boolean to false.

You can just use the vote_do.php to add log support, but I added votereward.php because it shows the user directly that the system is disabled. Otherwise, user types in the username and password, and then sees the system is disabled.
How can i add this to this scripts?
Because they are modified...
Well its not that xtra thing but hope you guys like it!

You need to use both files to get fully working!
Extra's: I added the function to go back to Form if already voted or Wrong ID....etc...
Modified Reward to give 10 CC.
Receive Credits Button modified---> You dont need to vote and to receive credits 1 by 1... If you click Receive Credits you get the credits+it navigates to vote page(votelink)
Hey Millenial maybe you can ceck if everything is Ok with this!

Hope you like it! :thumbup:

Edit: Fixed version added :)
 
Back
Top