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
Extracting real visitor IP
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: 387623" data-attributes="member: 71840"><p>Mate, I quote, <strong>DO NOT</strong>, try to get the real IP from a visitor, <strong>INSTEAD</strong> you should run a script that detects whether or not, an user is using a proxy/vpn.</p><p>In your<strong> Index.php </strong>file, wipe the file clean, and add this:</p><p>[PHP]</p><p><?php</p><p>if(isset($_GET['url'])) {</p><p> $_GET['url'] = strtolower($_GET['url']);</p><p>}</p><p></p><p>define('IN_INDEX', 1);</p><p></p><p>require_once 'global.php';</p><p></p><p>if($core->validIP() == false) {</p><p> $core->handleCall($db->secure('error'));</p><p> $template->html->get($db->secure('error'));</p><p>} else {</p><p> $core->handleCall($db->secure($_GET['url']));</p><p> $template->html->get($db->secure($_GET['url']));</p><p>}</p><p></p><p>$template->outputTPL();</p><p>?></p><p>[/PHP]</p><p>And now in your <strong>class.core.php</strong> file add this:</p><p>[PHP]</p><p>final public function validIP() {</p><p> global $_CONFIG;</p><p> $url = 'https://check.getipintel.net/check.php?ip='.$_SERVER['REMOTE_ADDR].'&flags=f&format=json&oflags=bc&contact='.$_CONFIG['hotel']['mail'];</p><p></p><p> $get = file_get_contents($url);</p><p> $json = json_decode($get, true);</p><p></p><p> if($json['status'] == 'success') {</p><p> if($json['BadIP'] == '0') {</p><p> if(in_array($json['Country'], array('SE','DK','NO'))) {</p><p> if($json['result'] >= '0.987654321') {</p><p> return false;</p><p> } else {</p><p> return true;</p><p> }</p><p> }</p><p> return false;</p><p> }</p><p> return false;</p><p> }</p><p> return false;</p><p> }</p><p>[/PHP]</p><p>Now the <strong>in_array</strong>() functions detects, whether or not a user is from the allowed countries (determined by country codes)</p><p>Now go to <strong>interface.core.php </strong>and add this:</p><p>[PHP]</p><p> public function validIP();</p><p>[/PHP]</p><p></p><p>You welcome, hope it was useful, and for <strong>DDoS Protection</strong> I recommend <strong>Bitninja.io</strong> <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="MayoMayn, post: 387623, member: 71840"] Mate, I quote, [B]DO NOT[/B], try to get the real IP from a visitor, [B]INSTEAD[/B] you should run a script that detects whether or not, an user is using a proxy/vpn. In your[B] Index.php [/B]file, wipe the file clean, and add this: [PHP] <?php if(isset($_GET['url'])) { $_GET['url'] = strtolower($_GET['url']); } define('IN_INDEX', 1); require_once 'global.php'; if($core->validIP() == false) { $core->handleCall($db->secure('error')); $template->html->get($db->secure('error')); } else { $core->handleCall($db->secure($_GET['url'])); $template->html->get($db->secure($_GET['url'])); } $template->outputTPL(); ?> [/PHP] And now in your [B]class.core.php[/B] file add this: [PHP] final public function validIP() { global $_CONFIG; $url = 'https://check.getipintel.net/check.php?ip='.$_SERVER['REMOTE_ADDR].'&flags=f&format=json&oflags=bc&contact='.$_CONFIG['hotel']['mail']; $get = file_get_contents($url); $json = json_decode($get, true); if($json['status'] == 'success') { if($json['BadIP'] == '0') { if(in_array($json['Country'], array('SE','DK','NO'))) { if($json['result'] >= '0.987654321') { return false; } else { return true; } } return false; } return false; } return false; } [/PHP] Now the [B]in_array[/B]() functions detects, whether or not a user is from the allowed countries (determined by country codes) Now go to [B]interface.core.php [/B]and add this: [PHP] public function validIP(); [/PHP] You welcome, hope it was useful, and for [B]DDoS Protection[/B] I recommend [B]Bitninja.io[/B] :) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Extracting real visitor IP
Top