miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Saving IP address used during registration

Page  Page 1 of 2:  1  2  Next »  
Author marsbar
Associated Member
#1 | Posted: 2 Nov 2004 05:14 
Currently, miniBB does not log a user's IP adress until (s)he posts something. Is there any way the next miniBB version could capture the IPs of new users when they first sign up?
All the best,
- mb

Author Paul
Lead Developer
#2 | Posted: 17 May 2006 18:02 | Edited by: Paul 
Solution: How to save IP on sign-up in database.

/********************************************/

Add new field in database, using following mySQL command (substitute `minibbtable_users` for your users table name, if it's different):

ALTER TABLE `minibbtable_users` ADD `user_customip` VARCHAR(16) NOT NULL DEFAULT '';

This field will contain user registration IP. Determine order number of this field using our tool "determine_fields.php" - place it in forums folder and point URL to it. You will notice order number of this field in your users table.

/********************************************/

Edit $dbUserSheme array setup_options.php, and define new field the following way:

'user_customip'=>array(ORDER_NUMBER,'user_customip','')

Something like this for default database:

$dbUserSheme=array(
'username'=>array(1,'username','login'),
'user_password'=>array(3,'user_password','passwd'),
'user_email'=>array(4,'user_email','email'),
'user_icq'=>array(5,'user_icq','icq'),
'user_website'=>array(6,'user_website','website'),
'user_occ'=>array(7,'user_occ','occupation'),
'user_from'=>array(8,'user_from','from'),
'user_interest'=>array(9,'user_interest','interest'),
'user_viewemail'=>array(10,'user_viewemail','user_viewemail'),
'user_sorttopics'=>array(11,'user_sorttopics','user_sorttopics'),
'language'=>array(14,'language','language'),
'num_topics'=>array(15,'num_topics',''),
'num_posts'=>array(16,'num_posts',''),
'user_custom1'=>array(18,'user_custom1','user_custom1'),
'user_custom2'=>array(19,'user_custom2','user_custom2'),
'user_custom3'=>array(20,'user_custom3','user_custom3'),
'user_customip'=>array(21,'user_customip','')
);

/********************************************/

Paste into bb_plugins2.php the following code (note: you must have register_globals turned OFF in php.ini, else this could be hijacked):

/* save registration IP */
if($action=='register' and isset($GLOBALS['insres']) and $GLOBALS['insres']!=0){
${$dbUserSheme['user_customip'][1]}=getIP();
updateArray(array($dbUserSheme['user_customip'][1]), $Tu, $dbUserId, $GLOBALS['insres']);
}
/* --save registration IP */

/********************************************/

Paste into bb_plugins.php the following code:

/* Show registration IP in Profile */

if($action=='userinfo'){
foreach($mods as $k=>$v) if(in_array($user_id,$v)) $isMod=1;
if($user_id==1 or $isMod==1) $l_usrInfo[15]='Registration IP';

if($user_id==1){

function parseUserInfo_user_customip($val){
return '<a href="'.$GLOBALS['main_url'].'/'.$GLOBALS['indexphp'].
'action=viewipuser&amp;postip='.$val.'">'.$val.'</a>';
}

}

}

/* --Show registration IP in Profile */

/********************************************/


IP should be visible in user's profile by admin or moderator. Admin should have linked IP, which goes to all users were posted from this IP.

Enjoy and report the result :-)

Author marsbar
Associated Member
#3 | Posted: 18 May 2006 01:34 
Thank you so much, Paul - will report back results as soon as I have some data.
Cheers,
mb

Author marsbar
Associated Member
#4 | Posted: 18 May 2006 03:52 
Hi again, Paul.

I am sorry to report that my attempt to implement your latest solution has failed; I am getting a syntax error:
"Parse error: syntax error, unexpected '{' in /server path/bb_plugins.php on line 138"

Line 138 of my bb_plugins.php is
return "<a href="{$GLOBALS['main_url']}/{$GLOBALS['indexphp']}action=viewipuser&amp;postip={$val}">{$val}</a>";

- mb

Author Paul
Lead Developer
#5 | Posted: 18 May 2006 09:31 
Whoops, the code has been broken a bit... check bb_plugins.php code above again (updated) and re-insert it.

Author _Marco
Registered
#6 | Posted: 18 May 2006 18:59 
marsbar
Is there any way the next miniBB version could capture the IPs of new users when they first sign up?

Will this be available in the next version?

_Marco

Author Paul
Lead Developer
#7 | Posted: 19 May 2006 06:42 
The code above shows that it will be available only as an addon ;-)

Author marsbar
Associated Member
#8 | Posted: 19 May 2006 23:52 
Thanks, Paul, for the updated code - the solution works perfectly!
Will you consider making this addon available from the miniBB Downloads area?
Cheers,
mb

Author Paul
Lead Developer
#9 | Posted: 22 May 2006 09:42 
I'll do that later.

Author marsbar
Associated Member
#10 | Posted: 1 Aug 2006 04:30 
Hi Paul,
The IP of a new member to my forum is showing up as "unknown"!?! (I can see the user's IP address in the server access log.)
- mb

Author Paul
Lead Developer
#11 | Posted: 1 Aug 2006 07:54 
Yes. It's possible if it's written such manner, I often analyze our own logs and see some IPs can be determined this way. But I don't know how it happens, probably some program hides IP or something... do not know.

Author marsbar
Associated Member
#12 | Posted: 2 Aug 2006 08:58 
Paul wrote: probably some program hides IP or something... do not know.

Thanks for taking the time to reply, Paul. Yes, I think it may have been a conscious attempt by the user to conceal his IP--not a very successful attempt though as I can see his IP in the server log. :-)
- mb

Author Paul
Lead Developer
#13 | Posted: 2 Aug 2006 09:38 | Edited by: Paul 
Well, what you see in logs is not obligately the true. I've checked how miniBB function getIP() works (which determines the user's IP), and it works the following way:

1) Determines REMOTE_ADDR variable (this could be the real user's IP)
2) Determines HTTP_X_FORWARDED_FOR variable (this could be a real user's IP, if it's behind the proxy and it's reported by the proxy - but it doesn't work always)
3) If there is some value for HTTP_X_FORWARDED_FOR, then final IP is equal to this value. Else it's equal to REMOTE_ADDR.

I think, the most weak point is #3, because we can not really say what's going on the way from user to proxy. So, what you could see on miniBB, is that "proxy hidden IP", and your logs are showing "real IP", BUT it also could be, if your logs saved "proxy IP", at the same time miniBB reported "real" hidden IP.

If I could test this thing in practice, I would be more than happy, but unfrotunatelly, it works only in theory.

Author marsbar
Associated Member
#14 | Posted: 2 Aug 2006 09:50 
Paul wrote: Well, what you see in logs is not obligately the true.

Yes, that is true. :-)

Thank you for explaining how getIP() works in miniBB.
Cheers,
mb

Author radeg
Guest
#15 | Posted: 14 Oct 2006 03:34 
I have a problem: IP it is displayed on a profile's page by all without exception, you are independent moderator or any user (without login)...

Page  Page 1 of 2:  1  2  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Saving IP address used during registration Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB