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

Post by TerraFrost » Fri May 20, 2005 5:10 am

Not that I know of. I can implement that feature, but atm, it isn't uber high on my priority list (I have other MODs needing attention before this one)...

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

Post by happypappy » Wed May 25, 2005 6:07 am

i get this error when trying to install....and im a newb and have never done any sql alterations....please help...thank

Code: Select all

An error was encountered while processing the SQL commands. Further SQL processing has been halted. You may choose to complete the MOD installation anyway and perform the SQL commands manually yourself. However, at this point EM cannot guarantee the MOD will work correctly so you are best off seeking support from the Author before continuing further.

The failed line was:
ALTER TABLE phpbb_users ADD user_regip CHAR(8) NOT NULL DEFAULT '0'

SQL Error: 1060
Duplicate column name 'user_regip' 
  

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

Post by happypappy » Wed May 25, 2005 6:24 am

figured it out :wink:

Justas
Registered User
Posts: 14
Joined: Fri May 13, 2005 6:47 pm
Location: Estonia
Contact:

Post by Justas » Wed May 25, 2005 3:38 pm

I slapped up a piece of code that will find the IP most often posted from for each user and, if you disable the debug mode, it also adds the values to your forum database (provided that you have the user_regip column all set up with this mod ;)).

I will not be responsible for any possible harm caused by this code and encourage you to look it over yourself before using, as it's mainly meant for more advanced users. But TerraFrost is free to use it to create an add-on in the next version of this mod, if he so wishes ;)

Do note that you will need to either create a mysql_connect.php or change the filename in the include command to suit your environment, as described below. Also, you might want to run it in debug mode first to see if the results look normal.

Code: Select all

<?php

if (!file_exists('mysql_connect.php')) {
 echo "File mysql_connect.php not found. Please check the source first";
 exit;
}

//Here should be a file that connects to the server and selects the forum database
include('mysql_connect.php');

$debug = 1; // Change this to 0 if you want the file to make the modifications in your database.

if ($debug) echo "This file is in debug mode, please check the source first<p>";

$query = "SELECT poster_ip, poster_id FROM phpbb_posts";
$result = mysql_query($query);

while ($array = mysql_fetch_assoc($result)) {
 $ip = $array['poster_ip'];
 $id = $array['poster_id'];
 $ipcount[$id][$ip]++;
}

ksort($ipcount);

foreach ($ipcount as $user=>$ips) {
 arsort($ipcount[$user]);
 if ($user != -1) $user_ips[$user] = key($ipcount[$user]);
}

if (!$debug) {
 foreach ($user_ips as $user=>$ip) {
  if (mysql_query("UPDATE phpbb_users SET user_regip = '$ip' WHERE user_id = '$user'"))
   echo "Changed user #$user's registration IP to $ip<br>";
  else echo "<font color=red>Couldn't change registration IP for user #$user</font><br>";
 }
}
else { echo "Showing gathered data ([User ID] => IP):<p><pre>"; print_r($user_ips); }

?>

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

Post by TerraFrost » Wed May 25, 2005 8:15 pm

Looks like a useful script, Justas - thanks! :)

User avatar
CyberMartyr
Registered User
Posts: 18
Joined: Sat Aug 21, 2004 4:07 pm
Location: Bellwood, IL.
Contact:

Post by CyberMartyr » Sun Jun 26, 2005 10:23 pm

I needed this, thanx! I run a forum for a band and we get these dead spammer accounts.

unwillingsong
Registered User
Posts: 39
Joined: Tue May 18, 2004 9:38 pm

Post by unwillingsong » Mon Jul 18, 2005 5:38 pm

I installed this mod--fine...no problems. But now I can't delete users. Any suggestions?

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

Post by TerraFrost » Mon Jul 18, 2005 6:35 pm

On a virgin phpBB, there's only one place users can be deleted - the ACP User Administration interface. The portion of that file responsible for deleting users is as follows:

Code: Select all

			$sql = "DELETE FROM " . USERS_TABLE . "
				WHERE user_id = $user_id";
			if( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $sql);
			}
Since this MOD doesn't modify that, I can only surmise that you either have a heavily modified phpBB and this MOD is incompatable with another, or that this MOD wasn't installed correctly.

As such, assuming that you're trying to delete users via the ACP User Administration interface and that the error you recieved said 'Could not delete user', then posting admin_users.php might prove helpful.

I say might because, for heavily modified boards, there's a fair chance I won't be able to test it out, myself (ie. I'd need to have made the appropriate DB changes / changes to included files, etc)

unwillingsong
Registered User
Posts: 39
Joined: Tue May 18, 2004 9:38 pm

Post by unwillingsong » Mon Jul 18, 2005 6:39 pm

I need to be a little clearer.

I'm *trying* to delete a user...but when I go into the user's profile and click "Delete", it tells me no such user exists.

Thanks for your help, btw.

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

Post by TerraFrost » Mon Jul 18, 2005 6:48 pm

Instead of paraphrasing the error, could you tell me the actual error? Once I have the actual error, I can see where it occurs and what the reason for it might be.

Also, how, exactly, are you going into the user's profile? Do you go through the ACP or not?

unwillingsong
Registered User
Posts: 39
Joined: Tue May 18, 2004 9:38 pm

Post by unwillingsong » Mon Jul 18, 2005 6:50 pm

TerraFrost wrote: Instead of paraphrasing the error, could you tell me the actual error? Once I have the actual error, I can see where it occurs and what the reason for it might be.

Also, how, exactly, are you going into the user's profile? Do you go through the ACP or not?


The actual error is the screen that comes up when I click on DELETE USER: Sorry, but that user does not exist.

I am using the ACP to get into the user's profile.

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

Post by TerraFrost » Mon Jul 18, 2005 7:12 pm

In a virgin admin_users.php, the string "$lang['No_user_id_specified']" should occur three times. Could you maybe post the five or lines that come before and after the line containing the above string?

Also, what other MODs have you installed?

Alternatively, you could, via PM, provide me with a temp. FTP account that I might use to diagnose / fix your problem.

unwillingsong
Registered User
Posts: 39
Joined: Tue May 18, 2004 9:38 pm

Post by unwillingsong » Mon Jul 18, 2005 7:19 pm


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

Post by TerraFrost » Mon Jul 18, 2005 8:01 pm

Admin Add User is the problem.

Find, in admin_user.php, the following:

Code: Select all

// Start replacement - Admin add user MOD
Then replace it with this:

Code: Select all

// Start replacement - Admin add user MOD
$user_id = ($new_user) ? $user_id : intval($HTTP_POST_VARS['id']);
// End replacement - Admin add user MOD
Hopefully this'll fix the problem for you (it did for me). If it doesn't, I'd recommend contacting the orig. author of the Admin add user MOD with follow up questions.

Anyway, the above problem is due to this line in the Admin Add Users install file:

Code: Select all

# 
#-----[ FIND ]------------------------------------------------ 
#
if ( (
{
$user_id = intval($HTTP_POST_VARS['id']);

# 
#-----[ IN-LINE FIND ]------------------------------------------------ 
#
$user_id = intval($HTTP_POST_VARS['id']);

# 
#-----[ IN-LINE REPLACE WITH ]---------------------------------------- 
#

// Start replacement - Admin add user MOD
$user_id = ($new_user) ? $user_id : intval($HTTP_POST_VARS['id']);
// End replacement - Admin add user MOD
IN-LINE actions aren't appropriate here and EasyMOD will only do an IN-LINE REPLACE WITH with the first line.

unwillingsong
Registered User
Posts: 39
Joined: Tue May 18, 2004 9:38 pm

Post by unwillingsong » Mon Jul 18, 2005 8:12 pm

Thank you! I'll give it a try! I appreciate your help!

Post Reply

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