How to add index voting to revcms
Hello Everyone,
My friend was looking around for a tutorial on how to add voting to your login page and all that
and he couldn't find anything. I don't know if there is any out there that actually help people
or that is done my way but i am going to make a very short and simple tutorial for you all.
Ok this is only for RevCMS and i will not be offering support to you as i'm never on the forums anyway but ill try make it very easy
Hello Everyone,
My friend was looking around for a tutorial on how to add voting to your login page and all that
and he couldn't find anything. I don't know if there is any out there that actually help people
or that is done my way but i am going to make a very short and simple tutorial for you all.
Ok this is only for RevCMS and i will not be offering support to you as i'm never on the forums anyway but ill try make it very easy
-------------------------------------------------------------------------------------------------------------
Ok lets start.
1. Open app/class.template.php and add ths code:
Code:
$this->setParams('votecheck', $core->CheckIfVoted($_SERVER['REMOTE_ADDR']));
Just add it uder the Mysql port or something i dont think it really matters aslong as its with the other ones like that.
2. Now open app/class.core.php and under this code
Code:
<?php
namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class core implements iCore
{
Add this code:
Code:
final public function CheckIfVoted($ip) {
$url = 'http://votingapi.com/validate.php?user=THEHABBOSNAME&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/THEHABBOSNAME" method="post" name="votingform">
<input type="hidden" name="api_url" value="YOURHOTELURL" />
</form>
<script language="javascript">setTimeout("document.forms[\'votingform\'].submit()",0);</script>';
exit;
}
3. In that Code change YOURHOTELURL and THEHABBOSNAME to all your stuff
4. Add {votecheck} at the very top off all your pages in your skin that you use on your hotel
5. Thats it your all done it should work now
Thanks for taking the time for reading my tutorial guys this is like my second tutorial i have ever made so i hope you all like it and i hope it is easy to read