16.06.2016, 02:41
Hey guys, I have added the most simple autologin system to my Admin mode, but I noticed something weird
When I register a new admin (in this case, myself), it marks the IP as 127.0.0.1 (which is localhost)
It also registers it on the database
Code:
This is where I update the data when an Admin disconnects
Now, I checked up my database and I noticed that the IP is 255.255.255.255
The RPIP is a simple code
How can I fix it ?
It prevents my autologin function from working
When I register a new admin (in this case, myself), it marks the IP as 127.0.0.1 (which is localhost)
It also registers it on the database
Code:
PHP Code:
if(!aInfo[playerb][aLevel])
{
mysql_format(mysql, query, sizeof(query), "INSERT INTO `Admins` (`Username`, `ALogin`, `APassword`, `AdminLevel`, `IP`) VALUES ('%e', '0', '', '%d', '%s')", RPN(playerb), level, RPIP(playerb));
mysql_tquery(mysql, query);
format(string, sizeof(string), "Congratulations, You have been promoted to level %d Admin by %s %s.", level, RPARN(playerid), RPN(playerid));
SendClientMessage(playerb, COLOR_RED, string);
SendClientMessage(playerb, COLOR_RED, "Please set your private admin password using /AdmPass, You cannot receieve your powers until then.");
AdminChat[playerid] = 1;
}
PHP Code:
if(aInfo[playerid][aLevel])
{
new query[1000], string[128];
mysql_format(mysql, query, sizeof(query), "UPDATE `Admins` SET `AdminLevel`='%d', `APassword`='%s', `IP`='%s', `ALogin`='%d' WHERE `Username`='%e' LIMIT 1",
aInfo[playerid][aLevel], aInfo[playerid][aPass], RPIP(playerid), aInfo[playerid][aALogin], RPN(playerid));
mysql_tquery(mysql, query);
format(string, sizeof(string), " Administrator %s has disconnected from the server.", RPN(playerid));
SendAMessage(1, string);
}
The RPIP is a simple code
PHP Code:
stock RPIP(playerid)
{
new ip[16];
GetPlayerIp(playerid, ip, sizeof(ip));
return ip;
}
It prevents my autologin function from working