Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
FindRetros API - Not Working REVCMS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Flukey" data-source="post: 444074" data-attributes="member: 82663"><p>Hey guys its really annoying me now i have tried everything to get force vote to work but nothing seems to work? i am using revcms do anyone have a fix for this? </p><p></p><p>thanks in advance....</p><p></p><p>Joshua...</p><p></p><p><a href="http://prntscr.com/mb7b0z" target="_blank">http://prntscr.com/mb7b0z</a></p><p></p><p><a href="http://prntscr.com/mb7b6w" target="_blank">http://prntscr.com/mb7b6w</a></p><p></p><p><forcevote.php></p><p><?php </p><p>2 </p><p>3 class FindRetros { </p><p>4 </p><p>5 private $pageName, $callTimeout, $usingCloudFlare, $apiPath; </p><p>6 </p><p>7 function __construct() { </p><p>8 </p><p>9 global $_CONFIG; </p><p>10 </p><p>11 $this->pageName = $_CONFIG['forcehotel2019']; </p><p>12 $this->requestTimeout = $_CONFIG['timeout']; </p><p>13 $this->usingCloudFlare = $_CONFIG['cloudflare']; </p><p>14 $this->apiPath = $_CONFIG['api']; </p><p>15 </p><p>16 if($this->usingCloudFlare) { </p><p>17 </p><p>18 if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { </p><p>19 </p><p>20 $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; </p><p>21 </p><p>22 } </p><p>23 </p><p>24 } </p><p>25 </p><p>26 } </p><p>27 </p><p>28 public function hasClientVoted() { </p><p>29 </p><p>30 if(!$this->_isVoteCookieSet()) { </p><p>31 </p><p>32 $urlRequest = $this->apiPath . 'validate.php?user=' . $this->pageName . '&ip=' . $_SERVER['REMOTE_ADDR']; </p><p>33 </p><p>34 $dataRequest = $this->_makeCurlRequest($urlRequest); </p><p>35 </p><p>36 if(in_array($dataRequest, array(1, 2))) { </p><p>37 </p><p>38 $this->_setVoteCookie(); </p><p>39 </p><p>40 return true; </p><p>41 </p><p>42 }else if($dataRequest == 3) { </p><p>43 </p><p>44 return false; </p><p>45 </p><p>46 }else{ </p><p>47 </p><p>48 /* There's something wrong with FindRetros, so we will mark the user as voted and have them proceed as if they voted. */ </p><p>49 </p><p>50 $this->_setVoteCookie(); </p><p>51 </p><p>52 return true; </p><p>53 </p><p>54 } </p><p>55 </p><p>56 } </p><p>57 </p><p>58 return true; </p><p>59 </p><p>60 } </p><p>61 </p><p>62 public function redirectClientToVote() { </p><p>63 </p><p>64 header('Location: ' . $this->apiPath . 'rankings/vote/' . $this->pageName); </p><p>65 </p><p>66 exit; </p><p>67 </p><p>68 } </p><p>69 </p><p>70 private function _makeCurlRequest($url) { </p><p>71 </p><p>72 if(function_exists('curl_version')) { </p><p>73 </p><p>74 $curl = curl_init(); </p><p>75 </p><p>76 curl_setopt($curl, CURLOPT_URL, $url); </p><p>77 curl_setopt($curl, CURLOPT_HEADER, 0); </p><p>78 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); </p><p>79 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); </p><p>80 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); </p><p>81 curl_setopt($curl, CURLOPT_TIMEOUT, $this->requestTimeout); </p><p>82 curl_setopt($curl, CURLOPT_USERAGENT, 'FindRetros Vote Validator'); </p><p>83 </p><p>84 $requestData = curl_exec($curl); </p><p>85 </p><p>86 curl_close($curl); </p><p>87 </p><p>88 }else{ </p><p>89 </p><p>90 $requestData = stream_context_create(array('http' => array('timeout' => $this->requestTimeout))); </p><p>91 </p><p>92 return @file_get_contents($url, 0, $requestData); </p><p>93 </p><p>94 } </p><p>95 </p><p>96 return $requestData; </p><p>97 </p><p>98 } </p><p>99 </p><p>100 private function _setVoteCookie() { </p><p>101 </p><p>102 $rankingsResetTime = $this->_getRankingsResetTime(); </p><p>103 </p><p>104 setcookie('voting_stamp', $rankingsResetTime, $rankingsResetTime); </p><p>105 </p><p>106 } </p><p>107 </p><p>108 private function _isVoteCookieSet() { </p><p>109 </p><p>110 if(isset($_COOKIE['voting_stamp'])) { </p><p>111 </p><p>112 if($_COOKIE['voting_stamp'] == $this->_getRankingsResetTime()) { </p><p>113 </p><p>114 return true; </p><p>115 </p><p>116 }else{ </p><p>117 </p><p>118 setcookie('voting_stamp', ''); </p><p>119 </p><p>120 return false; </p><p>121 </p><p>122 } </p><p>123 </p><p>124 } </p><p>125 </p><p>126 return false; </p><p>127 </p><p>128 } </p><p>129 </p><p>130 private function _getRankingsResetTime() { </p><p>131 </p><p>132 $serverDefaultTime = date_default_timezone_get(); </p><p>133 </p><p>134 date_default_timezone_set('America/Chicago'); </p><p>135 </p><p>136 $rankingsResetTime = mktime(0, 0, 0, date('n'), date('j') + 1); </p><p>137 </p><p>138 date_default_timezone_set($serverDefaultTime); </p><p>139 </p><p>140 return $rankingsResetTime; </p><p>141 </p><p>142 } </p><p>143 </p><p>144 }</p></blockquote><p></p>
[QUOTE="Flukey, post: 444074, member: 82663"] Hey guys its really annoying me now i have tried everything to get force vote to work but nothing seems to work? i am using revcms do anyone have a fix for this? thanks in advance.... Joshua... [URL]http://prntscr.com/mb7b0z[/URL] [URL]http://prntscr.com/mb7b6w[/URL] <forcevote.php> <?php 2 3 class FindRetros { 4 5 private $pageName, $callTimeout, $usingCloudFlare, $apiPath; 6 7 function __construct() { 8 9 global $_CONFIG; 10 11 $this->pageName = $_CONFIG['forcehotel2019']; 12 $this->requestTimeout = $_CONFIG['timeout']; 13 $this->usingCloudFlare = $_CONFIG['cloudflare']; 14 $this->apiPath = $_CONFIG['api']; 15 16 if($this->usingCloudFlare) { 17 18 if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { 19 20 $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; 21 22 } 23 24 } 25 26 } 27 28 public function hasClientVoted() { 29 30 if(!$this->_isVoteCookieSet()) { 31 32 $urlRequest = $this->apiPath . 'validate.php?user=' . $this->pageName . '&ip=' . $_SERVER['REMOTE_ADDR']; 33 34 $dataRequest = $this->_makeCurlRequest($urlRequest); 35 36 if(in_array($dataRequest, array(1, 2))) { 37 38 $this->_setVoteCookie(); 39 40 return true; 41 42 }else if($dataRequest == 3) { 43 44 return false; 45 46 }else{ 47 48 /* There's something wrong with FindRetros, so we will mark the user as voted and have them proceed as if they voted. */ 49 50 $this->_setVoteCookie(); 51 52 return true; 53 54 } 55 56 } 57 58 return true; 59 60 } 61 62 public function redirectClientToVote() { 63 64 header('Location: ' . $this->apiPath . 'rankings/vote/' . $this->pageName); 65 66 exit; 67 68 } 69 70 private function _makeCurlRequest($url) { 71 72 if(function_exists('curl_version')) { 73 74 $curl = curl_init(); 75 76 curl_setopt($curl, CURLOPT_URL, $url); 77 curl_setopt($curl, CURLOPT_HEADER, 0); 78 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 79 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 80 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); 81 curl_setopt($curl, CURLOPT_TIMEOUT, $this->requestTimeout); 82 curl_setopt($curl, CURLOPT_USERAGENT, 'FindRetros Vote Validator'); 83 84 $requestData = curl_exec($curl); 85 86 curl_close($curl); 87 88 }else{ 89 90 $requestData = stream_context_create(array('http' => array('timeout' => $this->requestTimeout))); 91 92 return @file_get_contents($url, 0, $requestData); 93 94 } 95 96 return $requestData; 97 98 } 99 100 private function _setVoteCookie() { 101 102 $rankingsResetTime = $this->_getRankingsResetTime(); 103 104 setcookie('voting_stamp', $rankingsResetTime, $rankingsResetTime); 105 106 } 107 108 private function _isVoteCookieSet() { 109 110 if(isset($_COOKIE['voting_stamp'])) { 111 112 if($_COOKIE['voting_stamp'] == $this->_getRankingsResetTime()) { 113 114 return true; 115 116 }else{ 117 118 setcookie('voting_stamp', ''); 119 120 return false; 121 122 } 123 124 } 125 126 return false; 127 128 } 129 130 private function _getRankingsResetTime() { 131 132 $serverDefaultTime = date_default_timezone_get(); 133 134 date_default_timezone_set('America/Chicago'); 135 136 $rankingsResetTime = mktime(0, 0, 0, date('n'), date('j') + 1); 137 138 date_default_timezone_set($serverDefaultTime); 139 140 return $rankingsResetTime; 141 142 } 143 144 } [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
FindRetros API - Not Working REVCMS
Top