[CMS] Vote Plugin

Elo

New Member
Jul 21, 2011
13
11
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
PHP:
final public function CheckIfVoted($ip) {
    global $_CONFIG;
    $context = stream_context_create(array('http' => array('timeout' => 2)));
    $data = file_get_contents('http://votingapi.com/validate.php?user=' . $_CONFIG["thehabbos"]["username"] . '&ip=' . $_SERVER["REMOTE_ADDR"], 0, $context);
    if(!$data || !is_numeric($data)) {
      echo "<!--[ERROR] System failure in voting system.-->";
      return false;
    } elseif($data == 3) {
      $return = str_replace('/', '!', 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
      header("Location: http://votingapi.com/vote.php?username=" . $_CONFIG["thehabbos"]["username"] . "&api=" . $return);
      exit;
    }
  }

(You need to change your config.php details to make it work)

Step 2:
Go to class.template.php (/app/class.template.php)
PHP:
Find: $this->setParams('server_ip', $_CONFIG['hotel']['server_ip']);
 
UNDER Add this code: $this->setParams('votecheck', $core->CheckIfVoted($_SERVER['REMOTE_ADDR']));

Step 3:
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:


Cheers
-Ole
 

Elo

New Member
Jul 21, 2011
13
11
Thanks for positive feedback, expect more add-ons in the future :) Feel free to come with ideas people
 

DannyX

New Member
Jan 31, 2011
11
0
I use cloudflare it keeps redirecting if i use this when I got to client?Help?

redirecting you to votingapi.com and then back to your website forever?
 
Aug 29, 2011
30
3
redirecting you to votingapi.com and then back to your website forever?
It's not forever. First it checks if you had already voted for the day, when it is, the client will automatically load, if not, it will direct you to the VOTING API (wherein you vote for the hotel) and he made it to be CLOSED, which means the user needs to vote the hotel before he or she can go to the client ~ so, it's not forever, if you voted, you can go directly to the client

After installing/modifying it, you can put {votecheck} on whatever page you want the user to vote before he/she can access the whole content.
 

savage

Member
Aug 6, 2011
69
7
well now i have got it working but all it dose is point to voteing for Kryptos and i have set up the config right :S
why is this -.-
 

AlexFallen

Developer
Jul 19, 2011
490
64
Help Please? What Exactly Do You Mean {votecheck} To The Page I Want It On? Do I Literally Put {votecheck} Into My Index?
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,194
3,901
Oshit lol, this is pretty good and smart, but you could just use the client.force.php that comes with the API? lol, but nonetheless, nice release.
 

Elo

New Member
Jul 21, 2011
13
11
Since this got bumped yesterday and people still seems to use this I've edited the function slightly, removed some useless variables and code. I also replaced the form with a header (votingapi.com required a form to be sent before).

Haven't tested it, let me know if it does not work.

PHP:
  final public function CheckIfVoted($ip) {
    global $_CONFIG;
    $context = stream_context_create(array('http' => array('timeout' => 2)));
    $data = file_get_contents('http://votingapi.com/validate.php?user=' . $_CONFIG["thehabbos"]["username"] . '&ip=' . $_SERVER["REMOTE_ADDR"], 0, $context);
    if(!$data || !is_numeric($data)) {
      echo "<!--[ERROR] System failure in voting system.-->";
      return false;
    } elseif($data == 3) {
      $return = str_replace('/', '!', 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
      header("Location: http://votingapi.com/vote.php?username=" . $_CONFIG["thehabbos"]["username"] . "&api=" . $return);
      exit;
    }
  }
 

Users who are viewing this thread

Top