Vote plugin for RevCMS
Features:
Automaticlly discover what url to be sent back to.
Automaticlly finds you user details in config.php
Forces the user to vote (no way out).
Recridts the user automatlicy to votingapi.com
(and returns to client when done voting)
If votingapi.com is offline it acts normal
Install:
Step 1:
Go to class.core.php (/app/class.core.php)
Insert this function called CheckIfVoted
(You need to change your config.php details to make it work)Code:final public function CheckIfVoted($ip) {
global $_CONFIG;
$vote_username = $_CONFIG['thehabbos']['username'];
$current_url = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
$hotelurl = $_CONFIG['hotel']['url'];
$url = 'http://votingapi.com/validate.php?user=' . $vote_username . '&ip=' . $ip;
$context = stream_context_create(array('http' => array('timeout' => 5)));
$data = @file_get_contents($url, 0, $context);
if(!$data || !is_numeric($data)) {
return "[ERROR] System Failure in voting system.";
} else if ($data == 1 || $data == 2) {
return "";
} else {
return '<form action="http://votingapi.com/vote/' . $vote_username . '" method="post" name="votingform">
<input type="hidden" name="api_url" value="' . $hotelurl . '/' . $current_url . '" />
</form>
<script language="javascript">setTimeout("document.forms[\'votingform\'].submit()",0); </script>';
exit;
}
}
Step 2:
Go to class.template.php (/app/class.template.php)
Step 3:Code:Find: $this->setParams('server_ip', $_CONFIG['hotel']['server_ip']);
UNDER Add this code: $this->setParams('votecheck', $core->CheckIfVoted($_SERVER['REMOTE_ADDR']));
You can now add {votecheck} to what page you want the user to vote before he/she watches the content
Download:
If you dont want to add the codes manually you can download it here: vote add-on.zip
(Direct link: vote add-on.zip add-on.zip)
Live Demo: Habztar: Best hotel around!
Cheers
-Ole
YOU CAN FIND RevCMS HERE: [1.X] RevCMS [PHP, MYSQL] | DevBest.com - MMORPG Private Server Development

