PDA

View Full Version : capture user-agent upon registration / email it to admins


karlm
09-09-2008, 11:16 AM
Hello folks,

I'm having problems from a troll who is able to use rotating proxies or similar to get through IP bans.

A co-admin has suggested I devise a bit of code to capture the user-agent on the signup page. Here's his post:

It's the same Ontario troll again. It's very difficult for me to keep him off the forum if the registration form bypasses the post screening. Also we need to store the user agent string when somebody registers. Now you can only check if the member happens to be online.

The simplest way would be to include a little piece of code in the right place that sends an email to one or more admins when a new member registers.

I'm using bola as a prefix to avoid conflict with existing variables.



$bola_username = "...";
$bola_useragent = "...";

$bola_to = 'my@mywebsite.com';
$bola_subject = 'member registration';

$bola_body = "new member: $bola_username \r\n";
$bola_body .= 'ip address: ' . $_SERVER['REMOTE_ADDR'] . "\r\n";
$bola_body .= 'user-agent: ' . $bola_useragent;

$bola_headers = 'From: registration@mysite.com' . "\r\n" .
'BCC: bola@mysite.net';

mail($bola_to, $bola_subject, $bola_message, $bola_headers);
Obviously the variables $bola_username and $bola_useragent need to be initialized with the values that the forum software has stored.

As I explained to my co-admin, bola, this is way over my head and I wouldn't know where to start.

Is anyone able to give me a bump start on this?

Cheers ahead!