AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with SQL, it saves not only the IP (https://forums.alliedmods.net/showthread.php?t=147119)

reinert 01-05-2011 14:42

Help with SQL, it saves not only the IP
 
Code:

ip varchar(32)
PHP Code:

new szIp[32]
get_user_ip(idszIpcharsmax(szIp))
            
new 
szTemp[512]
        
format(szTemp,charsmax(szTemp),"INSERT INTO `something` (`ip`)VALUES ('%s');",szIp



The problem is it saves output such as:

Quote:

78.60.101.151:27005
78.56.130.238:27005
Why not just a IP, without port ...



I guess you could ask me why I'm saving something on users IP ? Because I'm writing a php website script where you don't have to log in, it automaticly identifies ur IP and redirects you into your user control panel where you can buy various things such as admin/vip/slot ... I can't detect users steam ID via php :[.

t3hNox 01-05-2011 14:53

Re: Help with SQL, it saves not only the IP
 
Change:
Code:

get_user_ip(id, szIp, charsmax(szIp))
to:
Code:

get_user_ip(id, szIp, charsmax(szIp), 1)
The output will be without port.
http://www.amxmodx.org/funcwiki.php?...r_ip&go=search

reinert 01-05-2011 15:21

Re: Help with SQL, it saves not only the IP
 
thanks, hope it works.


All times are GMT -4. The time now is 01:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.