Secures your voting gateway from automated votes by using the Recaptcha system. You'll need to register on http://www.recaptcha.net/ and insert your API codes from there.
Example:

As seen on Lineage Server Toplist.
Instructions:
Create an account and get the required keys on recaptcha.net
Download the Recaptcha PHP File and upload to your sources folder.
Open sources/in.php
Find:
- Code: Select all
function in() {
global $CONF, $DB, $FORM
After $FORM, directly add:
- Code: Select all
, $TMPL
So it looks like:
- Code: Select all
function in() {
global $CONF, $DB, $FORM, $TMPL;
Find:
- Code: Select all
if ($CONF['gateway']) {
$valid = $this->check($username);
}
else {
$valid = 1;
}
After, Add: (Insert private key where stated)
- Code: Select all
// Recaptcha Mod
require_once($CONF['path'].'/sources/recaptchalib.php');
$privatekey = "INSERT YOUR PRIVATE KEY";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
unset($go_to_rankings);
unset($valid);
$TMPL['captcha_error'] = '<div class="error">Captcha was incorrect</div>';
$this->gateway($username);
}
//
Find:
- Code: Select all
require_once("{$CONF['path']}/sources/misc/session.php");
$session = new session;
$TMPL['sid'] = $session->create('gateway', $username);
$TMPL['username'] = $username;
After, Add: (Insert public key where stated)
- Code: Select all
// Recaptcha Mod
require_once($CONF['path'].'/sources/recaptchalib.php');
$publickey = "INSERT YOUR PUBLIC KEY";
$TMPL['captcha_code'] = recaptcha_get_html($publickey);
//
Open skins/{your skin}/gateway.html:
Find:
- Code: Select all
<p class="gatemessage">{$lng->gateway_text}</p><br /><br />
Underneath should be similar to:
- Code: Select all
<div class="votebox">
<span class="votehead"> </span>
<br /><br />
<a href="{$list_url}/index.php?a=in&u={$username}&sid={$sid}" class="cssbuttongo">{$lng->gateway_vote}</a><br /><br /><br />
<span class="votehead"> </span>
</div>
<div class="voteboxno">
<span class="votehead"> </span><br /><br />
<a href="{$list_url}/" class="cssbutton">{$lng->gateway_no_vote}</a><br /><br /><br />
<span class="votehead"> </span>
</div>
</div>
Replace with, or modify to, this:
- Code: Select all
<form method="post" action="{$list_url}/index.php?a=in&u={$username}&sid={$sid}">
{$captcha_error}
{$captcha_code}
<div class="votebox">
<span class="votehead"> </span>
<br /><br />
<input type="image" value="{$lng->gateway_vote}" class="cssbuttongo" /><br /><br /><br />
<span class="votehead"> </span>
</div>
<div class="voteboxno">
<span class="votehead"> </span><br /><br />
<a href="{$list_url}/" class="cssbutton">{$lng->gateway_no_vote}</a><br /><br /><br />
<span class="votehead"> </span>
</div>
</div>
</form>
Now adjust the design/css to your spec. You will need to insert into the screen.css your styling for the error class. I use this:
- Code: Select all
.error {
padding:10px;
margin:10px;
background:#561B1C;
border-top: 2px #fff solid;
border-bottom: 2px #fff solid;
color: #fff;
font-weight: bold;
text-align:center;
}
Done! Let me know if there's any problems with this.

