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
Miscellaneous
FindRetros
Help & Support
[API] Headers already send out
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="Eronisch" data-source="post: 169962" data-attributes="member: 2046"><p><strong>Warning</strong>: Cannot modify header information - headers already sent by (output started at /home/diaxa/public_html/habblo-world.tk/thehabbos_api/config.php:1) in <strong>/home/diaxa/public_html/habblo-world.tk/thehabbos_api/class.validate.php</strong> on line <strong>45</strong></p><p></p><p><strong>Warning</strong>: Cannot modify header information - headers already sent by (output started at /home/diaxa/public_html/habblo-world.tk/thehabbos_api/config.php:1) in <strong>/home/diaxa/public_html/habblo-world.tk/thehabbos_api/types/client.php</strong> on line <strong>21</strong></p><p><strong>Files:</strong></p><p>Class_validate:</p><p>[PHP]<?php</p><p>////////////////////////////////////////////////////////</p><p>// # TheHabbos Topsites API Script - Release 1.0.3 //</p><p>// # © Copyright TheHabbos 2011. All rights reserved. //</p><p>////////////////////////////////////////////////////////</p><p> </p><p>if(!defined('IN_THEHABBOS_API')) {</p><p> die('Sorry, but you can not access this file directly. :(');</p><p>}</p><p> </p><p>class Validate {</p><p> </p><p> public function validateVote() {</p><p> global $CONFIG;</p><p> if($this->checkCookie()) {</p><p> return 2;</p><p> }else{</p><p> $data = $this->getData('http://votingapi.com/validate.php?user='.$CONFIG['Username'].'&ip='.$_SERVER['REMOTE_ADDR']);</p><p> if(!$data || !is_numeric($data)) {</p><p> return 6;</p><p> }else{</p><p> if($data == 1 || $data == 2) {</p><p> $this->setCookie();</p><p> }</p><p> return $data;</p><p> }</p><p> }</p><p> }</p><p> </p><p> private function getData($url) {</p><p> global $CONFIG;</p><p> if($CONFIG['Curl_Enabled']) {</p><p> $ch = curl_init($url);</p><p> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</p><p> curl_setopt($ch, CURLOPT_TIMEOUT, $CONFIG['Timeout']); </p><p> return curl_exec($ch);</p><p> }else{</p><p> $context = stream_context_create(array('http' => array('timeout' => $CONFIG['Timeout'])));</p><p> return @file_get_contents($url, 0, $context);</p><p> }</p><p> }</p><p> </p><p> public function setCookie() {</p><p> $resetTime = $this->getResetTime();</p><p> setcookie('voting_stamp', $resetTime, $resetTime);</p><p> }</p><p> </p><p> private function checkCookie() {</p><p> $resetTime = $this->getResetTime();</p><p> if(isset($_COOKIE['voting_stamp'])) {</p><p> if($_COOKIE['voting_stamp'] == $resetTime) {</p><p> return true;</p><p> }else{</p><p> setcookie('voting_stamp', '');</p><p> return false;</p><p> }</p><p> }else{</p><p> return false;</p><p> }</p><p> }</p><p> </p><p> private function getResetTime() {</p><p> $defaultTime = date_default_timezone_get();</p><p> date_default_timezone_set('America/Chicago');</p><p> $resetTime = mktime(0, 0, 0, date('n'), date('j') + 1);</p><p> date_default_timezone_set($defaultTime);</p><p> return $resetTime;</p><p> }</p><p> </p><p>}[/PHP]</p><p> </p><p>Client:</p><p> </p><p>[PHP]</p><p><?php</p><p>////////////////////////////////////////////////////////</p><p>// # TheHabbos Topsites API Script - Release 1.0.3 //</p><p>// # © Copyright TheHabbos 2011. All rights reserved. //</p><p>////////////////////////////////////////////////////////</p><p> </p><p>if(!defined('IN_THEHABBOS_API')) {</p><p> die('Sorry, but you can not access this file directly. :(');</p><p>}</p><p> </p><p>switch($lookingFor) {</p><p> case 1:</p><p> {</p><p> //what happens if someone does successfully vote</p><p> header("Location: client.php");</p><p> break;</p><p> }</p><p> case 2:</p><p> {</p><p> //what happens if someone has already voted</p><p> header("Location: client.php");</p><p> break;</p><p> }</p><p> case 3:</p><p> {</p><p> //what happens if someone hasn't voted yet</p><p> echo '<div class="contentTitle">Please Vote</div></p><p> It appears that you have not voted yet today! Please click the button below.<br /></p><p> <br /></p><p> <form action="http://votingapi.com/vote/'.$CONFIG['Username'].'" method="post"></p><p> <input type="hidden" name="api_url" value="'.$CONFIG['URL'].'" /></p><p> <input class="button" type="submit" name="votingAPI" value="" /></p><p> </form>';</p><p> break;</p><p> }</p><p> case 4:</p><p> case 5:</p><p> {</p><p> //what happens if someone sends an invalid request</p><p> echo $LANG['content'][4].'<br /><br />Click <a href="client.php" style="color: #000000;">here</a> to proceed to the client.';</p><p> break;</p><p> }</p><p> case 6:</p><p> {</p><p> //what happens if thehabbos is down or having connection issues</p><p> header("Location: client.php");</p><p> break;</p><p> }</p><p>}</p><p>[/PHP]</p><p> </p><p>Config:</p><p> </p><p>[PHP]</p><p><?php</p><p>if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; }</p><p> </p><p>////////////////////////////////////////////////////////</p><p>// # TheHabbos Topsites API Script - Release 1.0.3 //</p><p>// # © Copyright TheHabbos 2011. All rights reserved. //</p><p>////////////////////////////////////////////////////////</p><p> </p><p>if(!defined('IN_THEHABBOS_API')) {</p><p> die('Sorry, but you can not access this file directly. :(');</p><p>}</p><p> </p><p> </p><p>/* FEEL FREE TO EDIT ANYTHING BELOW */</p><p> </p><p>$CONFIG['Username'] = 'diaxahotel26'; //thehabbos topsites username</p><p>$CONFIG['URL'] = 'http://habblo-world.tk/api2.php'; //the location to the file api.php on your website (i.e. http://example.com/api.php)</p><p>$CONFIG['Type'] = 'client'; //current options: other or client (thehabbos_api/types)</p><p>$CONFIG['Style'] = 'Habbo Sleek'; //don't change this unless you have created your own style (thehabbos_api/styles)</p><p>$CONFIG['Credits'] = '150'; //you can use this if you are using a specific type above - your users will be rewarded this many credits for voting</p><p> </p><p>/* ADVANCED OPTIONS */</p><p> </p><p>$CONFIG['Timeout'] = 2; //max amount of seconds before the api stops trying to connect to votingapi.com</p><p>$CONFIG['Curl_Enabled'] = 1; //mark this 0 if cURL isn't installed/enabled on your server, although cURL is recommended</p><p> </p><p>/* DO NOT EDIT ANYTHING BELOW */</p><p> </p><p>$votingValidation = new Validate();</p><p>$CONFIG['Status'] = $votingValidation->validateVote();</p><p>[/PHP]</p><p> </p></blockquote><p></p>
[QUOTE="Eronisch, post: 169962, member: 2046"] [B]Warning[/B]: Cannot modify header information - headers already sent by (output started at /home/diaxa/public_html/habblo-world.tk/thehabbos_api/config.php:1) in [B]/home/diaxa/public_html/habblo-world.tk/thehabbos_api/class.validate.php[/B] on line [B]45[/B] [B]Warning[/B]: Cannot modify header information - headers already sent by (output started at /home/diaxa/public_html/habblo-world.tk/thehabbos_api/config.php:1) in [B]/home/diaxa/public_html/habblo-world.tk/thehabbos_api/types/client.php[/B] on line [B]21[/B] [B]Files:[/B] Class_validate: [PHP]<?php //////////////////////////////////////////////////////// // # TheHabbos Topsites API Script - Release 1.0.3 // // # © Copyright TheHabbos 2011. All rights reserved. // //////////////////////////////////////////////////////// if(!defined('IN_THEHABBOS_API')) { die('Sorry, but you can not access this file directly. :('); } class Validate { public function validateVote() { global $CONFIG; if($this->checkCookie()) { return 2; }else{ $data = $this->getData('http://votingapi.com/validate.php?user='.$CONFIG['Username'].'&ip='.$_SERVER['REMOTE_ADDR']); if(!$data || !is_numeric($data)) { return 6; }else{ if($data == 1 || $data == 2) { $this->setCookie(); } return $data; } } } private function getData($url) { global $CONFIG; if($CONFIG['Curl_Enabled']) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, $CONFIG['Timeout']); return curl_exec($ch); }else{ $context = stream_context_create(array('http' => array('timeout' => $CONFIG['Timeout']))); return @file_get_contents($url, 0, $context); } } public function setCookie() { $resetTime = $this->getResetTime(); setcookie('voting_stamp', $resetTime, $resetTime); } private function checkCookie() { $resetTime = $this->getResetTime(); if(isset($_COOKIE['voting_stamp'])) { if($_COOKIE['voting_stamp'] == $resetTime) { return true; }else{ setcookie('voting_stamp', ''); return false; } }else{ return false; } } private function getResetTime() { $defaultTime = date_default_timezone_get(); date_default_timezone_set('America/Chicago'); $resetTime = mktime(0, 0, 0, date('n'), date('j') + 1); date_default_timezone_set($defaultTime); return $resetTime; } }[/PHP] Client: [PHP] <?php //////////////////////////////////////////////////////// // # TheHabbos Topsites API Script - Release 1.0.3 // // # © Copyright TheHabbos 2011. All rights reserved. // //////////////////////////////////////////////////////// if(!defined('IN_THEHABBOS_API')) { die('Sorry, but you can not access this file directly. :('); } switch($lookingFor) { case 1: { //what happens if someone does successfully vote header("Location: client.php"); break; } case 2: { //what happens if someone has already voted header("Location: client.php"); break; } case 3: { //what happens if someone hasn't voted yet echo '<div class="contentTitle">Please Vote</div> It appears that you have not voted yet today! Please click the button below.<br /> <br /> <form action="http://votingapi.com/vote/'.$CONFIG['Username'].'" method="post"> <input type="hidden" name="api_url" value="'.$CONFIG['URL'].'" /> <input class="button" type="submit" name="votingAPI" value="" /> </form>'; break; } case 4: case 5: { //what happens if someone sends an invalid request echo $LANG['content'][4].'<br /><br />Click <a href="client.php" style="color: #000000;">here</a> to proceed to the client.'; break; } case 6: { //what happens if thehabbos is down or having connection issues header("Location: client.php"); break; } } [/PHP] Config: [PHP] <?php if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; } //////////////////////////////////////////////////////// // # TheHabbos Topsites API Script - Release 1.0.3 // // # © Copyright TheHabbos 2011. All rights reserved. // //////////////////////////////////////////////////////// if(!defined('IN_THEHABBOS_API')) { die('Sorry, but you can not access this file directly. :('); } /* FEEL FREE TO EDIT ANYTHING BELOW */ $CONFIG['Username'] = 'diaxahotel26'; //thehabbos topsites username $CONFIG['URL'] = 'http://habblo-world.tk/api2.php'; //the location to the file api.php on your website (i.e. http://example.com/api.php) $CONFIG['Type'] = 'client'; //current options: other or client (thehabbos_api/types) $CONFIG['Style'] = 'Habbo Sleek'; //don't change this unless you have created your own style (thehabbos_api/styles) $CONFIG['Credits'] = '150'; //you can use this if you are using a specific type above - your users will be rewarded this many credits for voting /* ADVANCED OPTIONS */ $CONFIG['Timeout'] = 2; //max amount of seconds before the api stops trying to connect to votingapi.com $CONFIG['Curl_Enabled'] = 1; //mark this 0 if cURL isn't installed/enabled on your server, although cURL is recommended /* DO NOT EDIT ANYTHING BELOW */ $votingValidation = new Validate(); $CONFIG['Status'] = $votingValidation->validateVote(); [/PHP] [B][/B] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Miscellaneous
FindRetros
Help & Support
[API] Headers already send out
Top