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
PlusEmu and DDoS HELP
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="MayoMayn" data-source="post: 398380" data-attributes="member: 71840"><p>Here's an example:</p><p>[PHP]</p><p>public function checkXMLHttpRequest() {</p><p> if(empty($_SERVER['HTTP_X_REQUESTED_WITH']) ||</p><p> strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != "xmlhttprequest") {</p><p> die(http_response_code(403));</p><p> }</p><p> }</p><p>if(isset($_GET['ajax']) && $_GET['ajax'] == "callback") {</p><p> $core->checkXMLHttpRequest();</p><p> if(!isset($_POST['ajax']) || $_POST['ajax'] != "data")</p><p> die(http_response_code(403));</p><p> echo '{"HOST": "'.$config->hotel('server_ip').'", "PORT": "'.$config->hotel('bind_tcp_port').'", "SWF": "'.$config->hotel('swf_folder').'"}';</p><p> exit();</p><p>}</p><p>[/PHP]</p><p>client.php</p><p>[HTML]</p><p>var BaseUrl="{hotelurl}/swfs/gordon/"+SWF;</p><p>var flashvars={"connection.info.host":FUCK,"connection.info.port":OFF};</p><p>[/HTML]</p><p></p><p>Then in your swfobject javascript file, add this:</p><p>[HTML]</p><p>var g=null;</p><p>$.ajax({</p><p>url:"/ajax/game/callback",</p><p>data:"ajax=data",</p><p>dataType:"json",</p><p>method:"POST",</p><p>async:false,</p><p>success:function(c){</p><p>g=c;}</p><p>});</p><p>var FUCK=g.HOST;</p><p>var OFF=g.PORT;</p><p>var SWF=g.SWF;</p><p>[/HTML]</p><p></p><p>It's not 100% safe, because you can still use console.log like I mentioned above, or make an external ajax request on another server to receive the IP, but like 0 thinks about that.</p></blockquote><p></p>
[QUOTE="MayoMayn, post: 398380, member: 71840"] Here's an example: [PHP] public function checkXMLHttpRequest() { if(empty($_SERVER['HTTP_X_REQUESTED_WITH']) || strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != "xmlhttprequest") { die(http_response_code(403)); } } if(isset($_GET['ajax']) && $_GET['ajax'] == "callback") { $core->checkXMLHttpRequest(); if(!isset($_POST['ajax']) || $_POST['ajax'] != "data") die(http_response_code(403)); echo '{"HOST": "'.$config->hotel('server_ip').'", "PORT": "'.$config->hotel('bind_tcp_port').'", "SWF": "'.$config->hotel('swf_folder').'"}'; exit(); } [/PHP] client.php [HTML] var BaseUrl="{hotelurl}/swfs/gordon/"+SWF; var flashvars={"connection.info.host":FUCK,"connection.info.port":OFF}; [/HTML] Then in your swfobject javascript file, add this: [HTML] var g=null; $.ajax({ url:"/ajax/game/callback", data:"ajax=data", dataType:"json", method:"POST", async:false, success:function(c){ g=c;} }); var FUCK=g.HOST; var OFF=g.PORT; var SWF=g.SWF; [/HTML] It's not 100% safe, because you can still use console.log like I mentioned above, or make an external ajax request on another server to receive the IP, but like 0 thinks about that. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
PlusEmu and DDoS HELP
Top