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

SeraphicGate
Registered User
Posts: 207
Joined: Tue Dec 23, 2003 6:54 am

Post by SeraphicGate » Tue May 03, 2005 6:39 am

Yeah, I was trying to do it by hand. I see why it wouldn't work now, its an encoded IP. :D

If you can write up a script when you get a chance that would really help me out. I'm not sure how to add the IP for these two accounts.

Good luck on that exam. 8)

gothiqvanity
Registered User
Posts: 17
Joined: Mon May 02, 2005 5:32 am

Post by gothiqvanity » Wed May 04, 2005 12:06 am

Could not insert data into users table

DEBUG MODE

INSERT INTO phpbb_tgsusers (user_reg_ip, user_reg_host, 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_autospell, 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 ('22.222.222.222', 'ip22-222-222-222.something.com', 182, 'test123', 1115144728, 'cc03e747a6afbbcbf8be7668acfebee5', 'test123@test.com', '44e4ab75', '', '', 'occupation', 'location', 'interests', 'signature', 'efe9ca52ff', '', 0, 0, 'aimname', 'yahooname', 'msnname', 1, 1, 1, 1, 1, 1, 0, 1, 1, -6, 'D M d, Y g:i a', 'english', 2, 0, 1, 1, '')

Line : 651
File : usercp_register.php


I get this error when trying to register a new user on my site. I'm using phpBB 2.0.14 with these mods:

[2.0.14] Log IP Address on Registration
[2.0.13] SpellingCow Spell Checker

Since this is a SQL/PHP hybrid issue ... I wasn't too sure if I should post it here or the PHP forums. Sorry if I've misplaced, just looking for help and guidance.

Here is my usercp_register.php file, modified for SpellingCow Spell Checker and the Log IP Address on Registration modifications.
$sql = "INSERT INTO " . USERS_TABLE . " (user_reg_ip, user_reg_host, 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_autospell, 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 ('" . str_replace("\'", "''", $user_reg_id) . "', '" . str_replace("\'", "''", $user_reg_host) . "', $user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . $userdata['session_ip']. "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $spellcheck, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";


Line 651:
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )


-------- UPDATE/EDIT --------

I used EasyMod to complete it automatically. I had to change a mod after installing the 1st mod for the 2nd mod to work correctly since both mods look for information in a default usercp_register.php in mind -- WOW saying that was confusing ... I hope it was easy to follow LOL).

Each EasyMod install was a success.

Here is the area that the mods change in the usercp_register.php file (original settings):
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, 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 ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";


After installing both mods, here is what they look like (modified settings):
$sql = "INSERT INTO " . USERS_TABLE . " (user_reg_ip, user_reg_host, 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_autospell, 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 ('" . str_replace("\'", "''", $user_reg_id) . "', '" . str_replace("\'", "''", $user_reg_host) . "', $user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . $userdata['session_ip']. "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $spellcheck, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";

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

Post by TerraFrost » Wed May 04, 2005 6:48 am

Code: Select all

 $sql = "INSERT INTO " . USERS_TABLE . " (user_reg_ip, user_reg_host

Neither my MOD or SpellingCow add the user_reg_ip or user_reg_host field. SpellingCow adds user_autospell before user_allowsmile and this MOD adds user_regip before user_icq. As such, if you could install each MOD one at a time and post the contents of that particular INSERT query, that'd show us when its being added. If the user_reg_ip and user_reg_host fields aren't added, then I suspect the problem will be solved.

Anyway, to get this MOD working with Ptirhiik's Profile Control Panel, do the following...

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
profilecp/profilecp_register.php
#
#-----[ FIND ]------------------------------------------
#
		$userrow['user_regdate'] = time();
#
#-----[ BEFORE, ADD ]-----------------------------------
#
		$userrow['user_regip'] = $userdata['session_ip'];
To add a Registration IP field in wGEric's Admin Userlist...

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/userlist_body.tpl
#
#-----[ FIND ]------------------------------------------
#
			<option value="user_email">{L_EMAIL}</option>
#
#-----[ AFTER, ADD ]------------------------------------
#
			<option value="user_regip">{L_REGIP}</option>
#
#-----[ FIND ]------------------------------------------
#
				<tr>
					<td class="{user_row.ROW_CLASS}" colspan="3"><span class="gen"><b>{L_WEBSITE}:</b> <a href="{user_row.U_WEBSITE}" class="gen" target="_blank">{user_row.U_WEBSITE}</a></span></td>
				</tr>
#
#-----[ AFTER, ADD ]------------------------------------
#
				<tr>
					<td class="{user_row.ROW_CLASS}" colspan="3"><span class="gen"><b>{L_REGIP}:</b> {user_row.U_REGIP}</span></td>
				</tr>
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_userlist.php
#
#-----[ FIND ]------------------------------------------
#
			'L_WEBSITE' => $lang['Website'],
#
#-----[ AFTER, ADD ]------------------------------------
#
			'L_REGIP' => $lang['Registration_IP'],
#
#-----[ FIND ]------------------------------------------
#
				'U_WEBSITE' => ( $row['user_website'] ) ? $row['user_website'] : '',
#
#-----[ AFTER, ADD ]------------------------------------
#

				'U_REGIP' => decode_ip($row['user_regip']),
I haven't tested the ability to sort the userlist by IP Address to thoroughly. Also, I'd recommend changing "Registration IP Address" in lang_admin.php to "Registration IP" 'cause I think it looks nicer :)

Finally, SeraphicGate - I'll try to write your script tomorrow :)
Last edited by TerraFrost on Mon Mar 27, 2006 8:53 pm, edited 1 time in total.

User avatar
noth
Registered User
Posts: 2472
Joined: Fri Jan 07, 2005 7:10 pm
Location: North Surrey
Contact:

Post by noth » Wed May 04, 2005 10:26 pm

TerraFrost can this mod be incorporated as standard into 2.0.15 when it comes out please? surely every single admin should have this as default?

SeraphicGate
Registered User
Posts: 207
Joined: Tue Dec 23, 2003 6:54 am

Post by SeraphicGate » Wed May 04, 2005 11:45 pm

TerraFrost wrote:
Finally, SeraphicGate - I'll try to write your script tomorrow :)
Thanks

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

Post by TerraFrost » Thu May 05, 2005 8:25 pm

TerraFrost can this mod be incorporated as standard into 2.0.15 when it comes out please? surely every single admin should have this as default?

It's actually not really up to me, but that said, I can say that those whom it is up to probably won't include it, anyway.

Also, @SeraphicGate...

Code: Select all

<?
echo encode_ip($_GET['ip']);

function encode_ip($dotquad_ip)
{
	$ip_sep = explode('.', $dotquad_ip);
	return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
?>
You can call this by going to the following URL:

http://www.domain.tld/phpBB/encode.php?ip=127.0.0.1

4rum
Registered User
Posts: 60
Joined: Sun Jul 04, 2004 3:21 am

To add a Registration IP field in wGEric's Admin Userlist...

Post by 4rum » Thu May 05, 2005 9:31 pm

TerraFrost wrote: To add a Registration IP field in wGEric's Admin Userlist...

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/userlist_body.tpl
#
#-----[ FIND ]------------------------------------------
#
			<option value="user_email">{L_EMAIL}</option>
#
#-----[ AFTER, ADD ]------------------------------------
#
			<option value="user_email">{L_REGIP}</option>
#
#-----[ FIND ]------------------------------------------
#
				<tr>
					<td class="{user_row.ROW_CLASS}" colspan="3"><span class="gen"><b>{L_WEBSITE}:</b> <a href="{user_row.U_WEBSITE}" class="gen" target="_blank">{user_row.U_WEBSITE}</a></span></td>
				</tr>
#
#-----[ AFTER, ADD ]------------------------------------
#
				<tr>
					<td class="{user_row.ROW_CLASS}" colspan="3"><span class="gen"><b>{L_REGIP}:</b> {user_row.U_REGIP}</span></td>
				</tr>
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_userlist.php
#
#-----[ FIND ]------------------------------------------
#
			'L_WEBSITE' => $lang['Website'],
#
#-----[ AFTER, ADD ]------------------------------------
#
			'L_REGIP' => $lang['Registration_IP'],
#
#-----[ FIND ]------------------------------------------
#
				'U_WEBSITE' => ( $row['user_website'] ) ? $row['user_website'] : '',
#
#-----[ AFTER, ADD ]------------------------------------
#

				'U_REGIP' => decode_ip($row['user_regip']),
I haven't tested the ability to sort the userlist by IP Address to thoroughly. Also, I'd recommend changing "Registration IP Address" in lang_admin.php to "Registration IP" 'cause I think it looks nicer :)


Thanks very much TerraFrost 8)
Installed and works just perfect. Appreciated . :D

SeraphicGate
Registered User
Posts: 207
Joined: Tue Dec 23, 2003 6:54 am

Post by SeraphicGate » Fri May 06, 2005 12:14 am

TerraFrost wrote:

Code: Select all

<?
echo encode_ip($_GET['ip']);

function encode_ip($dotquad_ip)
{
	$ip_sep = explode('.', $dotquad_ip);
	return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
?>
You can call this by going to the following URL:

http://www.domain.tld/phpBB/encode.php?ip=127.0.0.1


Hi, TerraFrost

Sorry, I don't really understand how to do this. Could you give please give some instructions?

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

Post by TerraFrost » Fri May 06, 2005 2:16 am

This might be a bit easier to understand. Pretty much, you just want to change 127.0.0.1 in the following code segment to whatever IP address you're trying to encode. Then, copy the result and paste it into whatever you were using to do insert the unencoded IP addresses, earlier.

Code: Select all

<?
$address = '127.0.0.1';
echo encode_ip($address);

function encode_ip($dotquad_ip)
{
   $ip_sep = explode('.', $dotquad_ip);
   return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
?>

SeraphicGate
Registered User
Posts: 207
Joined: Tue Dec 23, 2003 6:54 am

Post by SeraphicGate » Fri May 06, 2005 2:48 am

That worked great! Encoded our two IP's and added them to the user each user table. Thanks, great mod by the way.

happypappy
Registered User
Posts: 463
Joined: Wed Apr 27, 2005 1:44 am

Post by happypappy » Tue May 10, 2005 3:22 pm

all new members after i installed this mod keep coming up with 00.00.00 as theier ip....how do i fix this....thanx

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

Post by TerraFrost » Tue May 10, 2005 4:39 pm

The fastest way to get your problem resolved is to give me a temp. FTP account. Short of that, what other MODs do you have installed?

happypappy
Registered User
Posts: 463
Joined: Wed Apr 27, 2005 1:44 am

Post by happypappy » Tue May 10, 2005 6:09 pm

i have only a few mods installed.....recently added the warning email mod with ip log incase another user accesses the ACP.......added who is online offline symbol mod........rank mods......prillian.....shoutbox......and the ip log at registration........i have a programmer working with these things.....please let me know what i need to do in order for this mod to work properly.....thanx

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

Post by TerraFrost » Tue May 10, 2005 8:09 pm

The only possible cause I can come up with right now is that this MOD is incompatable with one of the other MODs you've installed. Unfortunately, as I have final exams this week and the first part of next, I'm not uber interested, right now, in installing each one of these MODs until I find a conflict. I'll have more free time after the the middle of next week, though.

Also, something you could do to help me out is to create a testboard, of sorts. On this testboard, the first MOD you'd install would be this MOD. Then, you could install the other MODs you have installed on your main board until this MOD stops working. That'd reduce the work I have to do.

Posting the contents of includes/usercp_register.php might prove helpful, as well.

chesster
Registered User
Posts: 37
Joined: Tue Apr 05, 2005 3:25 am

Post by chesster » Fri May 20, 2005 4:42 am

Is there a mod that keeps a list of IP addresses of all users?

For example, insert the IP address if it is new, into the database whenever a user logs in. It will incur some cost at logging it, but it serves the purpose better. Admins can choose how many IP addresses need to be kept, to not let the number go to infinity.

Post Reply

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