PDA

View Full Version : Notification when members in a particular usergroup come online


John Stone
03-18-2005, 10:00 PM
A little background about this hack....

I don't ban users using vB's built-in functionality; instead, I block IPs/subnets by placing rules in my server's iptables configuration so that banned users can't even see the forum or my website. Additionally, I place banned (firewalled) users in a special usergroup I made called "firewalled". If someone in the "firewalled" usergroup gets by my firewall by using a non-blocked IP address, I let that user think s/he got one by me, and allow them to view the forum (but I don't allow posting, PMing or modification to user options). The reason I allow the banned user to view the forum for a short time is so that I can get the new IP and add it (or a subnet) to the firewall's rules.

The problem is, I'm not always online to catch people who get by my firewall and, of course, I can't remember all the users that have been banned. I wrote this little hack so that if a user in my "firewalled" usergroup comes online, it emails me the user name and the IP address. I can then add the IP to my firewall rules and block the user again. This hack works great with Logician's hack (https://vborg.vbsupport.ru/showthread.php?t=63013) that disallows a particular usergroup to log out. It's not a perfect system, but it's pretty darn effective.

This hack could be used in other scenarios. Let's say you have a few users you want to keep an eye on. You could create a special user group for those users, and this hack will email you immediately if one of them comes online. Obviously you could easily send the notification to a pager or cell phone, too.

I have it set so that only one notification is sent per user session. If the user's cookie times out and s/he comes back on, you'll get another notification.

This is a really simple hack. If you can copy and paste, then you have the skills required to install it. :nervous:

Tested with vB 3.07.

Deaths
03-19-2005, 03:52 PM
Cool hack, got yourself an install.

KanyeWest
03-19-2005, 03:55 PM
cool hack :devious:

WATRD
01-07-2007, 03:16 AM
Is there any reason why this would not be compatible with 3.6?

WATRD
01-07-2007, 03:30 AM
Hmm... okay, there is no "includes/sessions.php" that I can find in 3.6 :(

So, any suggestions from anyone more knowledgeable than me in this stuff? This would be a handy mod to have.

John Stone
01-07-2007, 12:41 PM
Hi WATRD,

I've not officially updated this hack because I've not had any time to mess with it or even learn the vB hooks system. However I did quickly get it working with vB 3.6x with few modifications.

One caveat: The place where this is hack is inserted into the vB code will email you each time the user does something on your forum. That's annoying. There is certainly a much better place to insert the code so that it will only email once per user session, which is how my original hack worked. I have not had time to locate the ideal location, so if anyone reading this wants to chime in, I'm all ears.

-------------

This will work with vB 3.6x, keeping the above caveat in mind:

On the line userinfo['usergroupid']==X, "X" should be replaced with the user group ID you want flagged.
On the line $emailaddr = "REPLACE WITH YOUR EMAIL ADDRESS"; add your email address where indicated.


In "includes/functions.php", look for:

$vbulletin->session->save();
... and insert this immediately after:


// ### EMAIL ADMIN IF FLAGGED USER COMES ONLINE - JOHN STONE HACK #################################################
$emailaddr = "REPLACE WITH YOUR EMAIL ADDRESS";
$ip = getenv("REMOTE_ADDR");
$user = ($vbulletin->userinfo['username']);
$subject = "Flagged user online!";
$message = "User: $user \nIP address: $ip";
if ($vbulletin->userinfo['usergroupid']==X)
{ // Flagged user
vbmail ($emailaddr, $subject, $message);
vbmail_end();
}
// ### EMAIL ADMIN IF FLAGGED USER COMES ONLINE - JOHN STONE HACK #################################################


I hope this helps. I'll post an official hack if I have time to make it work as intended with vB 3.6x, or if someone provides a better place to insert the code.

WATRD
01-07-2007, 01:48 PM
Thank you John! That DOES help. I want the hack for exactly the reasons you describe and have been looking for a way to not have to catch the person in the act.

For now, I will set up a mail filter to catch these mails and file them all away for me, but I will be interested if anyone spots a better place to install this.

Thank you for the response.

daddygrim
03-03-2007, 08:20 PM
well anybody?

biggeorge
06-30-2007, 06:11 PM
Hi WATRD,

I've not officially updated this hack because I've not had any time to mess with it or even learn the vB hooks system. However I did quickly get it working with vB 3.6x with few modifications.

I hope this helps. I'll post an official hack if I have time to make it work as intended with vB 3.6x, or if someone provides a better place to insert the code.

Worked like a champ for me... 3.6.4

I will watch the IP's for about 1-month and then include the IP's in my FAVORITE hack... Miserable Users! I like them to suffer the agony of MU then have them blocked at the server level :)

Thank you!