[REL] A better ban checker [1.X.X]

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
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.

Step 1: 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;
}
}

Done!
Step 2: 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;
}
}

Done!
Step 3: 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 } ?>

Done!

And that should be it, a quick thing to note 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.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Thanks for the release, Sled! I will definitely be implementing this into my hotel.

No problem, and you're welcome =D. - Also, I'm open for ideas on what to release next!
 

Logic

Bobby Billionaire
Feb 8, 2012
748
207
Dumb question, but like... what exactly does this do? Just check the user bans if you're banned?
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Dumb question, but like... what exactly does this do? Just check the user bans if you're banned?

Main post said:
I was looking through some users release packs and helping people out and saw some terrible ways of checking bans

Yes, if you read the steps you'd see it logs them out and tells them why.
 

zMagenta

Posting Freak
Jul 15, 2011
1,414
682
Thanks Craig. Implementing to my hotel now. Just scanning through the code and it looks like it'll work a dream.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Thanks Craig. Implementing to my hotel now. Just scanning through the code and it looks like it'll work a dream.

No problem. And it worked perfect for me, so should work perfect for you too :p.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
Worked great! Highly liking this! :up:

Glad it worked! - Also if there is anything else you think would make a nice release, reply to this comment saying what, and I'll consider it ^^
 

DaLightz

See ya'll in the afterlife.
May 19, 2012
1,136
262
Nicely done. It's about time someone has actually been using the features of Rev. Because I mean, it's just sitting there.
 

Kristopher

Photographer
Dec 25, 2010
803
68
Glad it worked! - Also if there is anything else you think would make a nice release, reply to this comment saying what, and I'll consider it ^^
I currently redone alot of my mates theme as he already had a decent edit of the habbo theme. I use a really shity and horrible ban checker will consider into putting this into my theme. Cheers Sleddy!

What to release? Better news comments. Minimail. Hot Campaigns. Something simple to create groups and have like 6 random badges shown each time. Sub navi up top where it says my friends my groups etc.. would be nice. Them are my targets of creating and im not all good with it so would say me alot of time and would be helpful as i would learn off the code.
 

Users who are viewing this thread

Top