($serverip == 127.0.0.1) could be the problem => server ips appear backwards when you echo them IE: 1.0.0.127