Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-18-2009, 07:46 AM
Shin Noir's Avatar
Shin Noir
Legendary Member
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 502
Default add lastlogin_ip field to account table submission

It is talked about here: http://www.eqemulator.net/forums/showthread.php?t=28285

Essentially, a lastlogin_ip field contains the last IP the user was known to have logged in as. It is useful for servers that utilize EQEMU's Login server for authentication and wish to have a way to authorize users via a web based tool at least by their IP to allow them to do modifications to their characters (or set options).
It also can be used to discover a player's IP if they try to log off quicker than you can type #iplookup in game.

I used this change, but really you can do this in a number of ways.

First create a patchfile in /utils/sql/svn/REV#_loginip.sql
Code:
ALTER TABLE `character_` ADD `lastlogin_ip` varchar(32) NOT NULL DEFAULT '';

in client.cpp, line 803:
From
Code:
database.UpdateLiveChar(char_name, GetAccountID());
To
Code:
	struct in_addr  in;
			in.s_addr = cle->GetIP();
	database.UpdateLiveChar(char_name, GetAccountID(), inet_ntoa(in));
in database.cpp, line 1805:
From
Code:
bool Database::UpdateLiveChar(char* charname,int32 lsaccount_id) {
To
Code:
bool Database::UpdateLiveChar(char* charname,int32 lsaccount_id, char* loginip) {
same file, line 808
From
Code:
	if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET charname='%s' WHERE id=%i;",charname, lsaccount_id), errbuf)) {
To
Code:
	if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE account SET charname='%s', lastlogin_ip='%s' WHERE id=%i;",charname, loginip, lsaccount_id), errbuf)) {
In database.h line 224
from
Code:
	bool	UpdateLiveChar(char* charname,int32 lsaccount_id);
To
Code:
	bool	UpdateLiveChar(char* charname,int32 lsaccount_id, char* loginip);

That's it.. Pretty sure this would update the IP every time a character logs in, and that's it. Which technically you could update this information when you a char first selects server, but no real reason the above modification is happening even without the ip being utilized.

I may have to release the struct properly, let me know if it's needed I'd like to learn that routine if you do add it.
__________________

~Shin Noir
DungeonEQ.com
Reply With Quote
 


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 -4. The time now is 04:48 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3