Skip to content

Instantly share code, notes, and snippets.

@artlung artlung/Blah.php
Created Mar 27, 2019

Embed
What would you like to do?
// needed as a debugging shim
class Blah {
function ip() {
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
//ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
//ip pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function userAgent() {
return $_SERVER['HTTP_USER_AGENT'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.