Infinite reloading

Eronisch

Web Developer
Jan 1, 2011
234
25
Hi,

I'm using cloudflare and a script someone here made, with a votecheck function for revcms.
But if i vote it redirects me to the page i wanted to go to, but that page keeps reloading.

However when i close the page, and reopen it and than go to the website again it works fine.
Because i have already voted, it seems like a mod-rewrite issue.

Does someone knows a fix for it?

This is the code i am using:

PHP:
        final public function CheckIfVoted($ip) {
                  global $_CONFIG;
                  $vote_username = "diaxahotel26";
                  $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;
                }
    }

Mod-Rewrite .htacces file:

PHP:
RewriteEngine On
 
RewriteRule ^(|/)$ index.php?url=$1
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?url=$1
RewriteRule ^(.*)\.htm$ $1.php [NC]
RewriteRule ^(|/)$ dash.php?page=$1
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ dash.php?url=$1
It does redirect me to the page i wanted to, but when i am on it. it keeps reloading.
 

iRekan

XboxOneFTW!
Nov 8, 2011
349
47
If the API is like this and you can't find any errors, just redirect the client page so it goes to
 

iRekan

XboxOneFTW!
Nov 8, 2011
349
47
Eh, I used to do it for my hotel when the API started to fuck up, the 'Enter Client' goes to the link I said before... You can change it within the theme
 

Damon

Member
Aug 13, 2012
364
114
hrmm in your TheHabbos config, where it says where is your API.php. Instead of linking it to your api, link to your client.

This may work. I believe this is the way I fixed mine..
 

Eronisch

Web Developer
Jan 1, 2011
234
25
This is the code i am using:

PHP:
        final public function CheckIfVoted($ip) {
                  global $_CONFIG;
                  $vote_username = "diaxahotel26";
                  $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;
                }
    }

Mod-Rewrite .htacces file:

PHP:
RewriteEngine On
 
RewriteRule ^(|/)$ index.php?url=$1
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ index.php?url=$1
RewriteRule ^(.*)\.htm$ $1.php [NC]
RewriteRule ^(|/)$ dash.php?page=$1
RewriteRule ^([a-zA-Z0-9_-]+)(|/)$ dash.php?url=$1
It does redirect me to the page i wanted to, but when i am on it. it keeps reloading.
 

Eronisch

Web Developer
Jan 1, 2011
234
25
What api do you recommend? i already tried a few.
The normal habbo api, causes problems as well.
 

Users who are viewing this thread

Top