Log IP Address on Registration

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
112
78%
Very Good
16
11%
Good
8
6%
Fair
3
2%
Poor
4
3%
 
Total votes: 143

TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Re: Log IP Address on Registration

Post by TerraFrost »

Sorry for the delay.

Anyway, assuming you still all the phpBB2 tables, do something like this:

Code: Select all

<?php
$username = 'change.me';
$password = 'change.me';

$phpbb2 = mysql_connect('localhost', $username, $password, true);
$phpbb3 = mysql_connect('localhost', $username, $password, true);

mysql_select_db('phpbb',  $phpbb2);
mysql_select_db('phpbb3', $phpbb3);

$sql = "SELECT user_id, user_regip FROM phpbb_users";
$result = mysql_query($sql, $phpbb2);

while ($row = mysql_fetch_assoc($result))
{
	if (!empty($row['user_regip']))
	{
		$sql = "UPDATE phpbb_users 
			SET user_ip = '".long2ip(hexdec($row['user_regip']))."' 
			WHERE user_id = ".$row['user_id'];
		mysql_query($sql, $phpbb3);
	}
}

mysql_close($phpbb2);
mysql_close($phpbb3);

?>

jalaln
Registered User
Posts: 1076
Joined: Tue Jul 05, 2005 5:05 am

Re: Log IP Address on Registration

Post by jalaln »

Awesome! 8-) Thank you very much! :D
No more spambots for phpBB2 and phpBB3.

Mojo47
Registered User
Posts: 2
Joined: Thu Feb 21, 2008 1:52 pm

Re: Log IP Address on Registration

Post by Mojo47 »

I try to install 3 times this mod and every time i receive this error with new users acounts:
Image
I waste few hours to figure out what is happening...please help me. Thanks!

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21035
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Log IP Address on Registration

Post by RMcGirr83 »

Check the edits to includes/usercp_register.php....specifically look at the

Code: Select all

$sql = "INSERT...
part. My guess is that you have misaligned database rows in the user table with the values being sent by the sql.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

Mojo47
Registered User
Posts: 2
Joined: Thu Feb 21, 2008 1:52 pm

Re: Log IP Address on Registration

Post by Mojo47 »

Problem was bellow, on "VALUES " line, i insert wrong ", " . $userdata['session_ip'] . " :oops: . Many thanks again :D

trusting
Registered User
Posts: 5
Joined: Wed Feb 27, 2008 4:10 am

Re: Log IP Address on Registration

Post by trusting »

Hi,

This looks like a great mod, but I've tried repeatedly to install it and keep getting an error:

______________________________________________________________
Could not insert data into users table

DEBUG MODE

SQL Error : 1054 Unknown column 'user_regip' in 'field list'

INSERT INTO phpbb_users (user_id, username, user_regdate, user_password, user_email, user_regip, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey) VALUES (89, 'test', 1204085278, '21232f297a57a5a743894a0e4a801fc3', 'teresa@nhbclj.org', 'cf77981f', '', '', '', '', '', '', '', '', 0, 0, '', '', '', 1, 1, 0, 1, 1, 0, 1, 1, -7, 'D M d, Y g:i a', 'english', 1, 0, 1, 0, '6d2810caa192087a6c7c')

Line : 647
File : usercp_register.php
_____________________________________________________________

I downloaded a clean copy of usercp_register.php and did all the changes on the fresh copy - same result.

I did the SQL install and my phpbb_users table shows a field for user_regip.

Any ideas?

Thanks,
Teresa

TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Re: Log IP Address on Registration

Post by TerraFrost »

Sounds like you didn't perform the requisite SQL:

Code: Select all

#
#-----[ SQL ]-------------------------------------------
#
ALTER TABLE phpbb_users ADD user_regip CHAR(8) NOT NULL DEFAULT '0';

trusting
Registered User
Posts: 5
Joined: Wed Feb 27, 2008 4:10 am

Re: Log IP Address on Registration

Post by trusting »

TerraFrost,
Sounds like you didn't perform the requisite SQL:

Code: Select all
#
#-----[ SQL ]-------------------------------------------
#
ALTER TABLE phpbb_users ADD user_regip CHAR(8) NOT NULL DEFAULT '0';
Thank you. I was sure that I had run the SQL. And I had ... in ANOTHER database. :oops: :roll:

Now it's allowing sign-ups. However, it's showing the IP as "0.0.0.0" even for new users. (I know the previous registrations will be that way.) I'm going to try some of the add ons to this MOD - like detecting the login IP.

Thanks for your help!
Teresa :)

TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Re: Log IP Address on Registration

Post by TerraFrost »

trusting wrote:Now it's allowing sign-ups. However, it's showing the IP as "0.0.0.0" even for new users. (I know the previous registrations will be that way.) I'm going to try some of the add ons to this MOD - like detecting the login IP.

Thanks for your help!
Teresa :)
You installed this MOD by hand, didn't you?

Anyway, this latest problem is most likely due to this:

http://www.phpbb.com/community/viewtopi ... 0#p1931240

trusting
Registered User
Posts: 5
Joined: Wed Feb 27, 2008 4:10 am

Re: Log IP Address on Registration

Post by trusting »

You installed this MOD by hand, didn't you?

Anyway, this latest problem is most likely due to this:

viewtopic.php?p=1931240#p1931240
Yes, I did install it by hand. I was careful to place the code inserts in the includes/usercp_register file in exactly the right place. Interestingly, when I went to the topic section you recommended and inserted the code there, it works. There was a slight variation in the install instructions in the file I downloaded and the code shown in the section you recommended:

The download file shows:

Code: Select all

, '" . $userdata['session_ip'] . "'
the topic code was:

Code: Select all

. "', '" . $userdata['session_ip']
Since the "find" instructions had the same slight difference (starting with the "," or the "." ), and I had been careful to insert it exactly where indicated, I don't know why that would matter. But it worked!

Thanks for your assistance and for a very helpful MOD!

God bless,
Teresa :)

TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Re: Log IP Address on Registration

Post by TerraFrost »

trusting wrote:Since the "find" instructions had the same slight difference (starting with the "," or the "." ), and I had been careful to insert it exactly where indicated, I don't know why that would matter. But it worked!
Oh - right. I forgot that I released a new version since that post, heh :)

sergyk
Registered User
Posts: 1
Joined: Tue Apr 22, 2008 6:37 pm

Re: Log IP Address on Registration

Post by sergyk »

After install this mod I have problem: after registration of new user in the begin of users table added users like ac1011b9 ac1011fa and reg ip is 0.0.0.0 for all users.
Any idea?

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21035
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Log IP Address on Registration

Post by RMcGirr83 »

TerraFrost wrote:
trusting wrote:Now it's allowing sign-ups. However, it's showing the IP as "0.0.0.0" even for new users. (I know the previous registrations will be that way.) I'm going to try some of the add ons to this MOD - like detecting the login IP.

Thanks for your help!
Teresa :)
You installed this MOD by hand, didn't you?

Anyway, this latest problem is most likely due to this:

http://www.phpbb.com/community/viewtopi ... 0#p1931240
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

reubanater
Registered User
Posts: 8
Joined: Wed Nov 28, 2007 3:11 pm

Re: Log IP Address on Registration

Post by reubanater »

I love this mod and was wondering if this would be possible or maybe it has even been already covered.

When the IP is shown I would also like the "IP Button" that is posted when someone post a topic so I can see if they match up with any other members who are already registered. I mainly want this to check users that will try to sign back up after being banned.

Can this be done and if so would someone provide the code for it? Thanks a Bunch!

User avatar
EverettB
Registered User
Posts: 326
Joined: Fri Aug 01, 2003 7:11 pm
Location: North America

Re: Log IP Address on Registration

Post by EverettB »


Post Reply

Return to “[2.0.x] MOD Database Releases”