FindRetros not working.

Status
Not open for further replies.

Parsov

Member
May 18, 2016
315
206
Howdy. Trying to figure out how to make FindRetros work followed bunch of tutorials didn't work.
Using this. Put in my page name and did everything added it into the top my Client and I keep getting HTTP 500 error.
Added it before the header same thing again. Added it after again same thing. Added it at the very end didn't help. Added it into another page didn't help either.
Nothing really helped. So I would be very happy if someone helped me with this issue.
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
PM me your VPS details
Post automatically merged:

Just a thought here.

When you're adding the following code to your client.php
PHP:
<?php
require_once 'findretros_config.php';
require_once 'findretros.php';
$FindRetros = new FindRetros();
if($FindRetros->hasClientVoted()) {
    echo 'You have voted!';
}else{
    // echo 'You have yet to vote!';
    $FindRetros->redirectClientToVote();
}
Have you tried ending it with ?>
 
Last edited:

Parsov

Member
May 18, 2016
315
206
You're clearly adding this wrong then, It's literally a copy and paste from my old CMS.
I added ?> into all of the files didn't help.
Then tried requiring it didn't work. There is an issue in FindRetros.php or I'm not doing the page name properly maybe.
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
I added ?> into all of the files didn't help.
Then tried requiring it didn't work. There is an issue in FindRetros.php or I'm not doing the page name properly maybe.
Here goes...

Add this to your client.php
PHP:
        <?php

require_once 'findretros_config.php';
require_once 'findretros.php';

$FindRetros = new FindRetros();

if($FindRetros->hasClientVoted()) {

    

}else{

    // echo 'You have yet to vote!';

    $FindRetros->redirectClientToVote();

} ?>
Add this to your skins folder (where the client.php is) called findretros_config.php
PHP:
<?php

$_CONFIG = array(

    /* What is "username" of your page on FindRetros? */

    'pagename' => 'Habbo',

    /* How many seconds should it take to try and reach FindRetros if it's down? */

    'timeout'  => 3,

    /* Are you using CloudFlare? If so, set this to true. */

    'cloudflare' => true,

    /* Incase FindRetros.com has a new domain, change it below. */

    'api' => 'https://findretros.com/'

);
Now, add this to your skins folder (where the client.php is) called findretros.php
PHP:
<?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;

    }

}
Make sure
Code:
    'pagename' => 'Habbo',
matches your FindRetro's hotel name.
 
Last edited:

Parsov

Member
May 18, 2016
315
206
Here goes...

Add this to your client.php
PHP:
        <?php

require_once 'findretros_config.php';
require_once 'findretros.php';

$FindRetros = new FindRetros();

if($FindRetros->hasClientVoted()) {

 

}else{

    // echo 'You have yet to vote!';

    $FindRetros->redirectClientToVote();

} ?>
Add this to your skins folder (where the client.php is) called findretros_config.php
PHP:
<?php

$_CONFIG = array(

    /* What is "username" of your page on FindRetros? */
 
    'pagename' => 'Habbo',

    /* How many seconds should it take to try and reach FindRetros if it's down? */

    'timeout'  => 3,

    /* Are you using CloudFlare? If so, set this to true. */

    'cloudflare' => true,

    /* Incase FindRetros.com has a new domain, change it below. */

    'api' => 'https://findretros.com/'

);
Now, add this to your skins folder (where the client.php is) called findretros.php
PHP:
<?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;

    }

}
Make sure
Code:
    'pagename' => 'Habbo',
matches your FindRetro's hotel name.
No more HTTP 500 but blank screen.
 

Parsov

Member
May 18, 2016
315
206
If you take the voting off the client, does it still load the Habbo.swf?
If yes, have you tried adding the code in the header of the page?
If no, is Flash enabled?
When you remove the voting hotel is loading fine let flash is enabled let me try to add this one into the header I tried the previous one it gave me HTTP 500.
Post automatically merged:

If you take the voting off the client, does it still load the Habbo.swf?
If yes, have you tried adding the code in the header of the page?
If no, is Flash enabled?
Added to Header blank page.
Any page I add it to now it just goes blank page.
But the HTTP 500 error is not showing anymore. Which is a bit weird.
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
When you remove the voting hotel is loading fine let flash is enabled let me try to add this one into the header I tried the previous one it gave me HTTP 500.
Post automatically merged:


Added to Header blank page.
Any page I add it to now it just goes blank page.
But the HTTP 500 error is not showing anymore. Which is a bit weird.
No idea then pal, just had it working on a CMS I setup to test this lol, worked fine.

Good luck!
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
Could you send the client to me?
PHP:
<?php

require_once 'findretros_config.php';
require_once 'findretros.php';

$FindRetros = new FindRetros();

if($FindRetros->hasClientVoted()) {

    echo 'You have voted!';

}else{

    // echo 'You have yet to vote!';

    $FindRetros->redirectClientToVote();

}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <link rel="shortcut icon" href="{url}/app/tpl/skins/{skin}/images/favicon.ico" type="image/vnd.microsoft.icon"/>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <title>{hotelName} - Client</title>
       
        <link rel="stylesheet" href="{url}/app/tpl/skins/{skin}/styles/client.css" type="text/css">
       
        <script type="text/javascript" src="{url}/app/tpl/skins/{skin}/js/swfobject.js"></script>
        <script type="text/javascript">
            var BaseUrl = "{url}/swfs/gordon/PRODUCTION-201701242205-837386173/";
            var flashvars =
            {
                "client.allow.cross.domain" : "1",
                "client.notify.cross.domain" : "0",              
                "connection.info.host" : "127.0.0.1",
                "connection.info.port" : "1232",
                "site.url" : "{url}",
                "url.prefix" : "{url}",
                "client.reload.url" : "{url}/disconnected",
                "client.fatal.error.url" : "{url}/disconnected",
                "client.connection.failed.url" : "{url}/disconnected",
                "external.variables.txt" : "{url}/swfs/gamedata/external_variables.txt",
                "external.texts.txt" : "{url}/swfs/gamedata/external_flash_texts.txt",
                "external.override.texts.txt" : "{url}/swfs/gamedata/override/external_flash_override_texts.txt",
                "external.override.variables.txt" : "{url}/swfs/gamedata/override/external_override_variables.txt",
                "external.figurepartlist.txt" : "{url}/swfs/gamedata/figuredata.xml",  
                "productdata.load.url" : "{url}/swfs/gamedata/productdata.txt",
                "furnidata.load.url" : "{url}/swfs/gamedata/furnidata.xml",
                "use.sso.ticket" : "1",
                "sso.ticket" : "{sso}",
                "client.starting" : "Please wait! {hotelName} is starting up.",              
                "processlog.enabled" : "0",
                "flash.client.url" : BaseUrl,
                "client.starting.revolving" : "For science, you monster/Loading funny message... please wait./Would you like fries with that?/Follow the yellow duck./Time is just an illusion./Are we there yet?!/I like your t-shirt./Look left. Look right. Blink twice. Ta da!/It\'s not you, it\'s me./Shhh! I\'m trying to think here./Loading pixel universe.",
                "flash.client.origin" : "popup"          
            };
            var params =
            {
                "base" : BaseUrl + "/",
                "allowScriptAccess" : "always",
                "menu" : "false"              
            };
            swfobject.embedSWF(BaseUrl + "/Habbo.swf", "client", "100%", "100%", "10.0.0", "{url}/swfs/gordon/PRODUCTION-201701242205-837386173/expressInstall.swf", flashvars, params, null);
        </script>
    </head>
   
    <body>
   
        <div id="client"></div>
    <?php include('includes/checktheban.php'); ?>
    </body>
</html>
Post automatically merged:

Did that work..?
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top