SA-MP Forums Archive
[Error, bug ?]Last Ip, Ip registration. mysql table - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Error, bug ?]Last Ip, Ip registration. mysql table (/showthread.php?tid=352340)



[Error, bug ?]Last Ip, Ip registration. mysql table - TheBluec0de - 19.06.2012

Pawn code:

PHP код:
format(query, sizeof(query), "INSERT INTO `%s` (`IP_Registration`, `Last_IP`) VALUES('%s', '%s')", TABLE_NAME, ip(playerid), ip(playerid));
//------------------------
public OnPlayerDisconnect(playerid, reason) {
    if(
UserInfo[playerid][USER_STAT_LOGGED] == true) {
        
format(query, sizeof(query), "UPDATE `%s` SET `Last_IP` = '%s' WHERE `Name` = '%s'",
        
TABLE_NAME,
        
ip(playerid),
    }
    
mysql_query(query);
    return 
1;
} 
In the database:

PHP код:
`IP_Registration` varchar(16) NOT NULL, `Last_IP` varchar(16) NOT NULL, 
when i register into the server save my ip. example: 79.45.145.150, but im quit the server save my last ip in: 255.255.255.255...

is normal?


Re: [Error, bug ?]Last Ip, Ip registration. mysql table - MadeMan - 19.06.2012

Quote:
Originally Posted by TheBluec0de
Посмотреть сообщение
is normal?
Yes.

https://sampforum.blast.hk/showthread.php?tid=331420


Re: [Error, bug ?]Last Ip, Ip registration. mysql table - TheBluec0de - 19.06.2012

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
and no way to fix?...


Re: [Error, bug ?]Last Ip, Ip registration. mysql table - Calgon - 19.06.2012

Just get the IP when the player connects or has logged in. There's no need to get it more than once, if the player's IP changes, they'll disconnect anyway.


Re: [Error, bug ?]Last Ip, Ip registration. mysql table - TheBluec0de - 19.06.2012

thanks, i have solved: i have put

PHP код:
        format(query, sizeof(query), "UPDATE `%s` SET `Last_IP` = '%s' WHERE `Name` = '%s'", 
        
TABLE_NAME, 
        
ip(playerid), 
when player logged...