FindRetros Voting Not Workin

gochad

Lacrim
Feb 9, 2019
122
20
Hey there ive done everything right and idk why it doeset work heres the code



<?php
class FindRetros {
private $pageName, $callTimeout, $usingCloudFlare, $apiPath;
function __construct() {
global $_CONFIG;
$this->pageName = $_CONFIG['pagename'];
$this->requestTimeout = $_CONFIG['timeout'];
$this->usingCloudFlare = $_CONFIG['cloudflare'];
$this->apiPath = $_CONFIG['api'];
if($this->usingCloudFlare) {
if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
}
}
public function hasClientVoted() {

if(!$this->_isVoteCookieSet()) {
$urlRequest = $this->apiPath . 'validate.php?user=' . $this->pageName . '&ip=' . $_SERVER['REMOTE_ADDR'];
$dataRequest = $this->_makeCurlRequest($urlRequest);
if(in_array($dataRequest, array(1, 2))) {
$this->_setVoteCookie();
return true;
}else if($dataRequest == 3) {
return false;
}else{
/* There's something wrong with FindRetros, so we will mark the user as voted and have them proceed as if they voted. */
$this->_setVoteCookie();
return true;
}
}
return true;
}
public function redirectClientToVote() {
header('Location: ' . $this->apiPath . 'rankings/vote/' . $this->pageName);
exit;
}
private function _makeCurlRequest($url) {
if(function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, $this->requestTimeout);
curl_setopt($curl, CURLOPT_USERAGENT, 'FindRetros Vote Validator');
$requestData = curl_exec($curl);
curl_close($curl);
}else{
$requestData = stream_context_create(array('http' => array('timeout' => $this->requestTimeout)));
return @file_get_contents($url, 0, $requestData);
}
return $requestData;
}
private function _setVoteCookie() {
$rankingsResetTime = $this->_getRankingsResetTime();
setcookie('voting_stamp', $rankingsResetTime, $rankingsResetTime);
}
private function _isVoteCookieSet() {
if(isset($_COOKIE['voting_stamp'])) {
if($_COOKIE['voting_stamp'] == $this->_getRankingsResetTime()) {
return true;
}else{
setcookie('voting_stamp', '');
return false;
}
}
return false;
}
private function _getRankingsResetTime() {
$serverDefaultTime = date_default_timezone_get();
date_default_timezone_set('America/Chicago');
$rankingsResetTime = mktime(0, 0, 0, date('n'), date('j') + 1);

date_default_timezone_set($serverDefaultTime);

return $rankingsResetTime;
}
}
<?php
class FindRetros {
private $pageName, $callTimeout, $usingCloudFlare, $apiPath;
function __construct() {
global $_CONFIG;
$this->pageName = $_CONFIG['pagename'];
$this->requestTimeout = $_CONFIG['timeout'];
$this->usingCloudFlare = $_CONFIG['cloudflare'];
$this->apiPath = $_CONFIG['api'];
if($this->usingCloudFlare) {
if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
}
}
public function hasClientVoted() {

if(!$this->_isVoteCookieSet()) {
$urlRequest = $this->apiPath . 'validate.php?user=' . $this->pageName . '&ip=' . $_SERVER['REMOTE_ADDR'];
$dataRequest = $this->_makeCurlRequest($urlRequest);
if(in_array($dataRequest, array(1, 2))) {
$this->_setVoteCookie();
return true;
}else if($dataRequest == 3) {
return false;
}else{
/* There's something wrong with FindRetros, so we will mark the user as voted and have them proceed as if they voted. */
$this->_setVoteCookie();
return true;
}
}
return true;
}
public function redirectClientToVote() {
header('Location: ' . $this->apiPath . 'rankings/vote/' . $this->pageName);
exit;
}
private function _makeCurlRequest($url) {
if(function_exists('curl_version')) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_TIMEOUT, $this->requestTimeout);
curl_setopt($curl, CURLOPT_USERAGENT, 'FindRetros Vote Validator');
$requestData = curl_exec($curl);
curl_close($curl);
}else{
$requestData = stream_context_create(array('http' => array('timeout' => $this->requestTimeout)));
return @file_get_contents($url, 0, $requestData);
}
return $requestData;
}
private function _setVoteCookie() {
$rankingsResetTime = $this->_getRankingsResetTime();
setcookie('voting_stamp', $rankingsResetTime, $rankingsResetTime);
}
private function _isVoteCookieSet() {
if(isset($_COOKIE['voting_stamp'])) {
if($_COOKIE['voting_stamp'] == $this->_getRankingsResetTime()) {
return true;
}else{
setcookie('voting_stamp', '');
return false;
}
}
return false;
}
private function _getRankingsResetTime() {
$serverDefaultTime = date_default_timezone_get();
date_default_timezone_set('America/Chicago');
$rankingsResetTime = mktime(0, 0, 0, date('n'), date('j') + 1);

date_default_timezone_set($serverDefaultTime);

return $rankingsResetTime;
}
}
<?php
$_CONFIG = array(
/* What is "Yumbo Hotel" of your page on FindRetros? */

'pagename' => 'yumbo69',
/* How many seconds should it take to try and reach FindRetros if it's down? */
'timeout' => 2,
/* Are you using CloudFlare? If so, set this to true. */
'cloudflare' => true,
/* Incase FindRetros.com has a new domain, change it below. */
'api' => ' '
);
<?php



require_once 'findretros_config.php';

require_once 'findretros.php';



$findRetros = new FindRetros();



if(!$findRetros->hasClientVoted()) {

$findRetros->redirectClientToVote();

}



?>
<!DOCTYPE html>
 

gochad

Lacrim
Feb 9, 2019
122
20
Do you get any errors?

What happens if you add the following to your `me.php`?
```
var_dump($findRetros->hasClientVoted());
exit;
```
ill try idfk why its doing this bcs i used to have my old files and my old shit it was perfect retro i wanted but now i started over and didnt backup the files so big oof bcs i changed vps and thought i did backup
 

Users who are viewing this thread

Top