Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 07-08-2009, 09:11 AM
Nxs's Avatar
Nxs Nxs is offline
 
Join Date: May 2004
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Storing the users current IP address

Regarding this thread :

http://www.vbulletin.com/forum/showthread.php?t=312600

Im trying to find a quick easy way to record a users name & ip address when they visit the forums, any ideas and suggestions from the community ?

My own thought was just to put a hook on the forumdisplay page to update the "ipaddress" in the "user" table, but not sure what impact this will have.
Reply With Quote
  #2  
Old 07-08-2009, 02:26 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are making the assumption that a user will first login to the forums prior to the game server? Is that always true? Personally, I'd do something with the server iptables to block ips that pound the server. Or, I'd talk to the host about different methods available to combat a dos attack.
Reply With Quote
  #3  
Old 07-08-2009, 02:31 PM
Nxs's Avatar
Nxs Nxs is offline
 
Join Date: May 2004
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
You are making the assumption that a user will first login to the forums prior to the game server? Is that always true? Personally, I'd do something with the server iptables to block ips that pound the server. Or, I'd talk to the host about different methods available to combat a dos attack.
After 3 days of being constantly DDOS'd we've tried those.

Our host will provide DDOS protection.... for $1,000 a month - so thats a non starter

We frequently run a PHP script to scan the apache access_log, find anything that has requested the same "GET" in a short time then add it to the IPTABLES list - this is working and catching about 80-90% of the ddos but its a task we have to run every few hours as and when new zombies power up

All players have been told if they are on DHCP they will need to browse the forums before they can loginto the game to ensure their IP is authorised, and they are happy with this if it will reduce the LAG of the current packet filter
Reply With Quote
  #4  
Old 07-08-2009, 03:00 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I can tell you that the IP in the user table is just the registration IP. If I were to try what you are doing, I'd create a new field called something like "current_ip" and put the current ip addy in there and use that instead of replacing the registration ip. As soon as a user logs into the site, I'd grab the ip and put it in the field.
Reply With Quote
  #5  
Old 07-11-2009, 06:10 PM
Nxs's Avatar
Nxs Nxs is offline
 
Join Date: May 2004
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any pointers on how to do this ? I did some plugins a long time ago and cant really remember that much

Ive created a custom user field, found it in the vb database structure. Just need to know the best way to update a userfield as a plugin.

I bet its really easy one liner, something simple like $vbulletin->setsomething.....
Reply With Quote
  #6  
Old 07-11-2009, 06:20 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually, it isn't just a one-liner. You need to add it to the datamanager array for the user (one of the class_dm_ files contains the array) and then you need to set the variable wherever it is that you grab the ip.
Reply With Quote
  #7  
Old 07-11-2009, 06:23 PM
Nxs's Avatar
Nxs Nxs is offline
 
Join Date: May 2004
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I guess this is really bad, sloppy poor coding then

but for a 1st draft it works, sure it wont detect a proxy but its a start


Code:
// test
$uid=$vbulletin->userinfo['userid'];

if ($uid > 0) {
     $query="UPDATE userfield SET field5='" . $_SERVER['REMOTE_ADDR'] . "' WHERE userid=$uid";
     mysql_query($query);
}
Reply With Quote
  #8  
Old 07-11-2009, 09:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I suppose you could do it that way. It isn't as clean as using the vbulletin datamanagers, but I suppose it will work.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:09 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06311 seconds
  • Memory Usage 2,226KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete