miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | 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 
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(POSITION_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 _Marco
Partaker
#3 | 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 
#4 | Posted: 19 May 2006 06:42 
The code above shows that it will be available only as an addon ;-)

Author marsbar
Associated Member
#5 | 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 
#6 | Posted: 22 May 2006 09:42 
I'll do that later.

Author marsbar
Associated Member
#7 | 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 
#8 | 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
#9 | 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 
#10 | Posted: 2 Aug 2006 09:38 
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
#11 | 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
#12 | 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)...

Author Paul
Lead Developer 
#13 | Posted: 16 Oct 2006 03:26 
IP should be shown on Profile's page only for admin. Be sure you are not logged in as admin when viewing it.

Author radeg
Guest
#14 | Posted: 19 Oct 2006 22:10 
Be sure you are not logged in as admin when viewing it.
I sure in it... you can see it too.

Author Paul
Lead Developer 
#15 | Posted: 20 Oct 2006 03:26 
Are you sure $l_usrInfo[15] variable is NOT inserted in language pack? If yes, it should NOT be inserted. You must change meaning of it directly in the code for /* Show registration IP in Profile */

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
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑