New version is out: [Only registered and activated users can see links. ]
Spoiler for OLD V1:
Description: How to add Vote for Items/Vote for Cash/Vote Script to your server
Difficulty: 4/10
What you should know: How to read, Copy+Paste, Some PHP + MySQL
Quick note: I am the owner of RuneTopList and this is the Voting Script which we provide for free to our users.
Hello guys, I will be showing you how to set up Vote4Items (View media spoiler for more details). This will only work if you use the new toplist (RuneTopList). I will be bring out a new version with any fixes which may be needed, more optimized and graphical improvements. When i bring out a new version it will be fully compatible to this version it will be a matter of just downloading the package and extracting it into the root folder. If you find any bugs just post on this topic or pm me if you don't want anyone knowing about them.
How does it look like?
Spoiler for media:
Click below for video
So why should you use this Vote4Items over others?
- No need for authcodes, user just needs to do ::check in game and gets their reward
- Doesn't need the use of top100arena which just lets a certain amount of the same IP subnets each day. (This created problems where the users may vote on other websites like runelocus but then not receiving their reward)
- Has analytics center where you can analyse when your getting the most votes, how good the current month is compared to last month. Who on your server has voted the most times and also what rewards are the players picking.
- Shows the user how long they can vote again with a JS count down timer.
- Easily editable all in the Config.php file (Which rewards are available, Which voting websites their are to vote on and many other things.)
So how can i get it working?
1. Download [Only registered and activated users can see links. ]and upload it to your htdocs (root folder) of your server. Then extract it. (Too many files to post them all here.)
MySQLi version: [Only registered and activated users can see links. ]
MySQL version: [Only registered and activated users can see links. ]
2. Log onto your SQL service and execute this code. (This will create the database and tables where the data will be saved)
Code:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
CREATE DATABASE `website` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `website`;
CREATE TABLE IF NOT EXISTS `items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(12) NOT NULL,
`item_id` int(11) NOT NULL,
`item_amount` int(11) NOT NULL DEFAULT '1',
`claimed` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;
CREATE TABLE IF NOT EXISTS `verifying_votes` (
`callbackid` varchar(10) NOT NULL,
KEY `callbackid` (`callbackid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `votes` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`ip` varchar(45) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
public static void checkVote(Client c) {
try {
if(c.getItems().freeSlots() > 0) {
//Statement stmt = con.createStatement();
ResultSet rs = query("SELECT id,item_id, item_amount FROM `items` WHERE `username`= '" + c.playerName + "' AND `claimed`= '0'");
if(rs.next()) {
int rowid = rs.getInt("id");
int itemid = rs.getInt("item_id");
int amount = rs.getInt("item_amount");
query("UPDATE `items` SET `claimed` = 1 WHERE `username` = '" + c.playerName + "' AND `id`='" + rowid + "'");
c.getItems().addItem(itemid, amount);
c.sendMessage("You receive "+amount+" X "+c.getItems().getItemName(itemid)+".");
} else {
c.sendMessage("No items waiting for you.");
}
} else {
c.sendMessage("Please make space for your items.");
}
} catch (SQLException ex) {
System.out.println(ex);
}
}
5. Create an account on [Only registered and activated users can see links. ]and when your signing up make sure that the callback URL looks like this but with your domain:
6. Edit the file called Config.php in root/vote/php/Config.php with all the relative details like database username, database password, voting links, your server name, etc...
If you get stuck or don't know how to do it, i can do it for free just pm me your problem and in most cases ill probably just do it for you so ill ask you for your TeamViewer details to be quicker.
Looks better then most voting systems. Great job i'm loving the way you choose to display the day through charts and showing the popularity on rewards.
It only checks that you have voted on RuneTopList as it has an callback feature. On RuneLocus it only checks that you have clicked the button as it doesn't have a callback feature.
how would i add more buttons fro more voting sites to this
Just extend this array, make sure it has the following pattern: website name, website link. YouŽll find this array in Config.php
I've done an example for you below.
If you want to not use it for Runetoplist, would it still work?
It wouldn't. However I would advise to using RuneTopList .
I'll be making a thread later about RuneTopList on the website development section where I will talk about it and its features. Have a look at it soon!