DeeEmm

Pragmatism in code

Waxing lyrical about life the universe and everything software related since lunchtime 2006.

Dolphin - Record user Name and ID with IP address

You can (fairly) easily record the userid along with the ip address by adding an extra field to the database table and modifying member.php

Here's how...

Add the following fields to the sys_ip_members_visits table in database

ALTER TABLE `sys_ip_members_visits` ADD `UserID` INT( 10 ) NOT NULL

ALTER TABLE `sys_ip_members_visits` ADD `UserName` VARCHAR( 30 ) NOT NULL

 

Then search for following line in member.php

$sInsertSQL = "INSERT INTO `sys_ip_members_visits` SET `From`='{$sCurLongIP}', `DateTime`=NOW()";

Replace it with

$aMemberInfo = getProfileInfoDirect($member['ID']);
$sUserName = $aMemberInfo['NickName'];

$sInsertSQL = "INSERT INTO `sys_ip_members_visits` SET `From`='{$sCurLongIP}', `DateTime`=NOW(), `UserID`='{$sUserID}', `UserName`='{$sUserName}'";


Now edit inc/classes/BxDolAdminIPBlocklist.php

Find

{$sFromC}{$sDatatimeC}

Change it to

IDUserName{$sFromC}{$sDatatimeC}


Find

$sLastDT = $aIPList['DateTime'];


Add After

$sUserID = $aIPList['UserID'];
$sUserName = $aIPList['UserName'];


Find

$sTableRes .= "{$sFrom}{$sLastDT}";

Replace it with

$sTableRes .= "{$sUserID}{$sUserName}{$sFrom}{$sLastDT}";

All Done!!

Now the userid will be recorded with the ip address and displayed in the table on the admin page.


Dolphin - Hide custom pages from non-members
Dolphin - Change landing page after login

Related Posts

 

Comments 11

Slip on Thursday, 01 July 2010 07:52

Way to go DM, I have been waiting for someone to code this up to tie the IP to the ID, Boonex's effort is rather strange not to have the IP and ID linked. No problem to block offending scammers and spammers now. Well done! 8)

0
Way to go DM, I have been waiting for someone to code this up to tie the IP to the ID, Boonex's effort is rather strange not to have the IP and ID linked. No problem to block offending scammers and spammers now. Well done! 8)
DeeEmm on Thursday, 08 July 2010 05:19

For those experiencing a little trouble with phpMyAdmin..

Navigate to the sys_ip_members_visits table - click on the 'structure' tab.

Now scroll down and find where it says add 1 fields at end of table. Click the button to add a field, this will take you to another page where you will need to fill in the details.

For Field - enter the text UserID
For Type - make it INT
and for Length - make it 10

Then hit save and you should be good to go.

0
For those experiencing a little trouble with phpMyAdmin..

Navigate to the sys_ip_members_visits table - click on the 'structure' tab.

Now scroll down and find where it says add 1 fields at end of table. Click the button to add a field, this will take you to another page where you will need to fill in the details.

For Field - enter the text UserID
For Type - make it INT
and for Length - make it 10

Then hit save and you should be good to go.
DeeEmm on Thursday, 08 July 2010 23:09

MNNN seems to be in issue with the tags getting stripped out of this article. I will have to have a look into it

0
MNNN seems to be in issue with the tags getting stripped out of this article. I will have to have a look into it
DeeEmm on Thursday, 08 July 2010 23:20

Fixed it

0
Fixed it :)
jason on Saturday, 24 July 2010 10:05

Thanks for the tip. I tried to expanded it to "Username" or "NickName" But i would get a DB error on login. Any idea on the proper insert statement in the first step to include User Name?

Thanks, Jason

0
Thanks for the tip. I tried to expanded it to "Username" or "NickName" But i would get a DB error on login. Any idea on the proper insert statement in the first step to include User Name?

Thanks, Jason
DeeEmm on Sunday, 25 July 2010 00:44

To include the username three things need to be changed - an extra field needs to be added to the database, the SQL statement needs to be updated to include the username and BxDolAdminBlocklist.php needs to be modified to display the additional field.

HTH

/DM

0
To include the username three things need to be changed - an extra field needs to be added to the database, the SQL statement needs to be updated to include the username and BxDolAdminBlocklist.php needs to be modified to display the additional field.

HTH

/DM
DeeEmm on Wednesday, 11 August 2010 02:42

Updated to include username and also added SQL statements to make installation easier.

0
Updated to include username and also added SQL statements to make installation easier.
Ron on Thursday, 16 December 2010 17:55

Is there an update for this for 7.0.4? Member.php is a little different, I tried a few things and couldn't get it working. THanks.

0
Is there an update for this for 7.0.4? Member.php is a little different, I tried a few things and couldn't get it working. THanks.
DeeEmm on Thursday, 16 December 2010 21:05

It looks like 7.0.4 already records the members nickname. Happy to take a look, but what would you like it to record?

0
It looks like 7.0.4 already records the members nickname. Happy to take a look, but what would you like it to record?
Ron on Friday, 17 December 2010 16:51

7.0.4 records ip's, but it's not showing the member name for me. It's kind of useless set up the way it is if you can't associate an account with an IP address. I has a box called "user" that's empty, I don't know if it's supposed to show the member''s ID, or their username, but it's missing

0
7.0.4 records ip's, but it's not showing the member name for me. It's kind of useless set up the way it is if you can't associate an account with an IP address. I has a box called "user" that's empty, I don't know if it's supposed to show the member''s ID, or their username, but it's missing
DeeEmm on Sunday, 19 December 2010 22:04

Ron, try checking the last page of recorded names. The list is in reverse order to what you may expect - newest last. I have some entries listed in mine, but not all. I have put this down to the RPX modification that I have installed, as it bypasses the login form.

0
Ron, try checking the last page of recorded names. The list is in reverse order to what you may expect - newest last. I have [i]some[/i] entries listed in mine, but not all. I have put this down to the RPX modification that I have installed, as it bypasses the login form.
Already Registered? Login Here
Guest
Saturday, 19 August 2017
If you'd like to register, please fill in the username, password and name fields.

Captcha Image