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:
Mod-Rewrite .htacces file:
It does redirect me to the page i wanted to, but when i am on it. it keeps reloading.
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