Not sure about this but I think that a single check if(strtolower($server_request) == $ajax_request) should be enough. Could you see how this IF statements behaves in PHP if $server_request is null or empty.