Need an Expert - PHP?

Chrisspitz

Member
Hello,
I have a toplist for a game called Minecraft.
My domain is minetop100.com

I am trying to add "support" for a plugin the game uses called Votifier. This is a plugin server owners put on their servers and when a user votes for their server on the toplist, it rewards them with something in game. When a server owner registers there server they are supposed to provide the toplist a "Public Key" that they can find in the contents of the plugin for their server after it loads for the first time.

Unfortunately, I do not understand the documentation for how to add this to my toplist because it is not a full guide just a basic layout, for people who know what their doing lol.

Anyways here is the guide below if you could take a read and translate what he means by '256 byte RSA encypted block' . . . I would be willing to pay someone to set this up for me if you are interested and reasonable.

Code:
Protocol Documentation

This documentation is for server lists that wish to add Votifier support.

A connection is made to the Votifier server by the server list, and immediately Votifier will send its version in the following packet:

"VOTIFIER <version>"
Votifier then expects a 256 byte RSA encrypted block (the public key should be obtained by the Votifier user), with the following format:

Type    Value
string    VOTE
string    serviceName
string    username
string    address
string    timeStamp
byte[]    empty
The first string of value "VOTE" is an opcode check to ensure that RSA was encoded and decoded properly, if this value is wrong then Votifier assumes that there was a problem with encryption and drops the connection. serviceName is the name of the top list service, username is the username (entered by the voter) of the person who voted, address is the IP address of the voter, and timeStamp is the time stamp of the vote. Each string is delimited by the newline character \n (byte value 10). The space block is the empty space that is left over, the block must be exactly 256 bytes regardless of how much information it holds.
More information about the plugin is available here:
http://forums.bukkit.org/threads/de...es-your-server-when-its-voted-for-1060.22308/

This is very important for me to get completed for the success of my toplist so i'm eager to get it done.

Thanks for anyones help in advance,
Chrisspitz
 

Basti

Administrator
Staff member
As far as i understand this plugin is easy to install, when first run it install itself. However it seem the download lack files. The advertised config file as well as the hole plugins folder seem not be in the package, so i cant really say anything more to it :(

Code:
Do this after you had installed the Votifier plug in on your server and installed the vote listener class.

1. Log in on Minestatus.net
2. Click on "Manage Servers" on the top menu.
3. Click on the banner of the server you want to manage.
4. Click "Edit" in the top right corner next to "Delete"
5. On the bottom check "Use Votifier"
6. Paste your public key found in /plugins/votifier/rsa/public.key into the "Votifier Public Key" text box.

Now when someone votes, there will be an additional text entry box above captcha box where the voter can put in his IGN. After the the vote is submitted, it will appear in votes.log in /plugins/votifier
Well but like i said i cant seem to find any config at all to install this. Seems strange
 

Basti

Administrator
Staff member
Does this help you out any further? http://forums.bukkit.org/threads/de...-server-when-its-voted-for-1060.22308/page-10
Post # 275

This seems to be the working php code for your website

Dont know yet where it should be best placed within your topsite code. I guess best via a plugin

I think all needed would be
1. a new field in the User controlpanel -> edit, where they can paste their key
2. the actual php code properly in sources/in.php , sligtly modified so it can grab the right key the users owns. and only interact with votifier if the vote is valid

That should do it. I might Pm you some detailed instruction sometime this week if i find the time. This properbly will take us some tries as i personally have no way to test this to give you the final result.
 

Chrisspitz

Member
This did help I obtained a working version of what I need below:

Code:
<?php

error_reporting(E_ALL);

// Details of the vote.
$str = "VOTE\n" .
      "mcserverstatus\n" .
      "ryanshawty\n" .
      "203.0.113.1\n" .
      time()."\n";

// Fill in empty space to make the encrypted block 256 bytes.
$leftover = (256 - strlen($str)) / 2;

while ($leftover > 0) {
    $str .= "\x0";
    $leftover--;
}

// The public key, this is an example.
$key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsbqjZCrHLKC5EyJQixqUjOQmjnLyKcfOduP3mgk4jRUnnZNkmFyHelMrGVl0gaBuIckOdHQvQi1zFckvQ2X4OOfhVreIdh7HuYmPvxXUFUytnIaUEtS37BKA3WFmPNhRsflPgX9Ci/z32rLZrl8Cf9s19JFYM0ffTaz0sGGqK7mDp2ImsPnsbnyBRCT3hhF00VupKJFWeN3FXLBSzh9CK2Rdh3ibZAsS+wmCGOi4S+iWNKKY2hHD/Ap7oFAiBW9jkY+McmZmvJnhjl6P551gYR076ClHMsW9fmxujaCmTkAP2TwzuZmsfgtmO1CQsouxhDvxbsozUxeHXl9ACQbIuwIDAQAB";
$key = wordwrap($key, 65, "\n", true);
$key = <<<EOF
-----BEGIN PUBLIC KEY-----
$key
-----END PUBLIC KEY-----
EOF;

// Encrypt the string.
openssl_public_encrypt($str, $encrypted, $key);

// Establish a connection to Votifier.
$socket = fsockopen("188.138.109.87", "8192", $errno, $errstr, 2);

if (!$socket) {
    die("Failed to connect to Votifier.");
}

// Send the contents of the encrypted block to Votifier.
fwrite($socket, $encrypted);
Now I just need to customize it for my toplist and figure out how to use it lol
 

Chrisspitz

Member
Oh and thanks a lot.
Now after looking at it I think I might have a new problem as well.

Usually at server toplists like mine when a person is voting for the server (site), they have to enter their username then press submit, no idea how I could implement this at all really since i'm not a total PHP wiz.

Any idea where I could hire someone to do some work like this for me?
My brother programs PHP forums and a lot sites etc. but he is usually busy with his work and i'd rather not bother him :|
 

Basti

Administrator
Staff member
I think there is not much for you to do at all. When they enter their username and press vote on the servers site. Votifier will interaact with your site, if it see the vote is valid it credits the users ( as you know i guess ). he username thingy should be an extension the server owner should install, not you. At least i think so.

I think all you need to provide is the "plattform" so his and your site can interact with each = the code we have above
and the key input in the control panel.

I can post something for you i guess on the weekend ( i got my job + visiolist ) and we will see if it works or not. If you are in a real hurry, you properbly want to hire one of the guys from the forums.
 

Chrisspitz

Member
Well in order for it to work properly the webhost has to send the gameserver the name of the user that voted, which when the user votes for a site I would have to make it lead to a page where the user can submit there username in their vote (how it works) :\

I am interested in getting it working, but the reason why I feel like i'm in such a hurry is because i'm sort of angry someone bought the other domain name of my site and has already started their own as well (and its looking better than mine already)... I was going to buy the domain as well when I was purchasing mine but I was going to put it off for a few weeks, but I guess I should've just bought it.

Mine is minetop100.com theres is mctop100.com >_>
 

ryancbarnes

Member
I think there is not much for you to do at all. When they enter their username and press vote on the servers site. Votifier will interaact with your site, if it see the vote is valid it credits the users ( as you know i guess ). he username thingy should be an extension the server owner should install, not you. At least i think so.

I think all you need to provide is the "plattform" so his and your site can interact with each = the code we have above
and the key input in the control panel.

I can post something for you i guess on the weekend ( i got my job + visiolist ) and we will see if it works or not. If you are in a real hurry, you properbly want to hire one of the guys from the forums.
Apparently I'm not the only one looking for this information!

Any word on whether or not you got this to work Chris/Basti?
 

Basti

Administrator
Staff member
At least i havent looked further into the issue, properbly chris did, but i dont know
 
Top