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 Releases
CMS Releases
[REL] A better ban checker [1.X.X]
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="Sledmore" data-source="post: 175865" data-attributes="member: 591"><p>Hey,</p><p> </p><p>I was looking through some users release packs and helping people out and saw some terrible ways of checking bans, so I thought I'd have ago to see if I can do a better one, and I think I have. I only used what Rev has built in by default for us.</p><p> </p><p>This check will be put in two places, one place for users that are NOT logged in that will check IP bans and tell them the reason if necessary, and the other checking both username and IP bans.</p><p> </p><p><strong>Step 1: IP Bans only.</strong></p><p>[spoiler="IP Bans only"]</p><p>1) Open up app/class.core.php</p><p>2) Find 'final public function handleCall($k)'.</p><p>3) Under 'if(!isset($_SESSION['user']['id'])) {' add the following:</p><p>[PHP]</p><p>if ($k != "index")</p><p>{</p><p>if($users->isBanned($_SERVER['REMOTE_ADDR']) == true)</p><p>{</p><p>$banReason = $users->getReason($_SERVER['REMOTE_ADDR']);</p><p> </p><p>session_destroy();</p><p>header("Location: index.php?url=index&reason={$banReason}");</p><p>exit;</p><p>}</p><p>}</p><p>[/PHP]</p><p> </p><p>Done!</p><p>[/spoiler]</p><p><strong>Step 2: User and IP Bans.</strong></p><p>[spoiler="User and IP Bans."]</p><p>1) Open up app/class.core.php</p><p>2) This might be harder for some users as they may of removed the last IP check, so you will have to find the else to the if statement, or search for 'switch($k)' (not the first one, the second one).</p><p>3) If you searched for 'switch($k)' then add the following snippet ABOVE that.</p><p>[PHP]</p><p>if ($k != "index")</p><p>{</p><p>if($users->isBanned($_SESSION['user']['username']) == true || $users->isBanned($_SERVER['REMOTE_ADDR']) == true)</p><p>{</p><p>$banReason = "";</p><p>if($users->isBanned($_SESSION['user']['username']) == true)</p><p>$banReason = $users->getReason($_SESSION['user']['username']);</p><p>else</p><p>$banReason = $users->getReason($_SERVER['REMOTE_ADDR']);</p><p> </p><p>session_destroy();</p><p>header("Location: index.php?url=index&reason={$banReason}");</p><p>exit;</p><p>}</p><p>}</p><p> </p><p> </p><p>[/PHP]</p><p> </p><p>Done!</p><p>[/spoiler]</p><p><strong>Step 3: Show the ban!</strong></p><p>[spoiler="Show the ban!"]</p><p>And now, the final part (I couldn't think of an easier way so I just made a new, if you would 'error checking' part, on the index now even if you have a different skin you should ALL have this on the index.</p><p> </p><p>1) Open up app/tpl/skins/YOURSKIN/index.php</p><p>2) Find 'if(isset($template->form->error))' and just BELOW '<?php } ?>' add the following:</p><p>[PHP]</p><p><?php if(isset($_GET['reason']) && $_GET['reason'] != null) { ?></p><p><div id="loginerrorfieldwrapper"></p><p><div id="loginerrorfield"></p><p><div><?php echo 'You have been banned for: '.filter($_GET['reason']); ?></div></p><p></div></p><p></div></p><p><?php } ?></p><p>[/PHP]</p><p> </p><p>Done!</p><p>[/spoiler]</p><p> </p><p>And that should be it, a quick thing to <strong>note </strong>the checker will check by username and not user ID, as I cannot remember if Phoenix checked via username or ID, I prefer ID (personally) but yeah simple to change this to user ID checking just edit '$_SESSION['user']['username']' to '$_SESSION['user']['id']'.</p><p> </p><p>- Thanks.</p></blockquote><p></p>
[QUOTE="Sledmore, post: 175865, member: 591"] Hey, I was looking through some users release packs and helping people out and saw some terrible ways of checking bans, so I thought I'd have ago to see if I can do a better one, and I think I have. I only used what Rev has built in by default for us. This check will be put in two places, one place for users that are NOT logged in that will check IP bans and tell them the reason if necessary, and the other checking both username and IP bans. [B]Step 1: IP Bans only.[/B] [spoiler="IP Bans only"] 1) Open up app/class.core.php 2) Find 'final public function handleCall($k)'. 3) Under 'if(!isset($_SESSION['user']['id'])) {' add the following: [PHP] if ($k != "index") { if($users->isBanned($_SERVER['REMOTE_ADDR']) == true) { $banReason = $users->getReason($_SERVER['REMOTE_ADDR']); session_destroy(); header("Location: index.php?url=index&reason={$banReason}"); exit; } } [/PHP] Done! [/spoiler] [B]Step 2: User and IP Bans.[/B] [spoiler="User and IP Bans."] 1) Open up app/class.core.php 2) This might be harder for some users as they may of removed the last IP check, so you will have to find the else to the if statement, or search for 'switch($k)' (not the first one, the second one). 3) If you searched for 'switch($k)' then add the following snippet ABOVE that. [PHP] if ($k != "index") { if($users->isBanned($_SESSION['user']['username']) == true || $users->isBanned($_SERVER['REMOTE_ADDR']) == true) { $banReason = ""; if($users->isBanned($_SESSION['user']['username']) == true) $banReason = $users->getReason($_SESSION['user']['username']); else $banReason = $users->getReason($_SERVER['REMOTE_ADDR']); session_destroy(); header("Location: index.php?url=index&reason={$banReason}"); exit; } } [/PHP] Done! [/spoiler] [B]Step 3: Show the ban![/B] [spoiler="Show the ban!"] And now, the final part (I couldn't think of an easier way so I just made a new, if you would 'error checking' part, on the index now even if you have a different skin you should ALL have this on the index. 1) Open up app/tpl/skins/YOURSKIN/index.php 2) Find 'if(isset($template->form->error))' and just BELOW '<?php } ?>' add the following: [PHP] <?php if(isset($_GET['reason']) && $_GET['reason'] != null) { ?> <div id="loginerrorfieldwrapper"> <div id="loginerrorfield"> <div><?php echo 'You have been banned for: '.filter($_GET['reason']); ?></div> </div> </div> <?php } ?> [/PHP] Done! [/spoiler] And that should be it, a quick thing to [B]note [/B]the checker will check by username and not user ID, as I cannot remember if Phoenix checked via username or ID, I prefer ID (personally) but yeah simple to change this to user ID checking just edit '$_SESSION['user']['username']' to '$_SESSION['user']['id']'. - Thanks. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[REL] A better ban checker [1.X.X]
Top