Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php user ip from post request

// Function to get the client IP address
function get_client_ip() {
    $ipaddress = '';
    if (isset($_SERVER['HTTP_CLIENT_IP']))
        $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
    else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
        $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
    else if(isset($_SERVER['HTTP_X_FORWARDED']))
        $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
    else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
        $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
    else if(isset($_SERVER['HTTP_FORWARDED']))
        $ipaddress = $_SERVER['HTTP_FORWARDED'];
    else if(isset($_SERVER['REMOTE_ADDR']))
        $ipaddress = $_SERVER['REMOTE_ADDR'];
    else
        $ipaddress = 'UNKNOWN';
    return $ipaddress;
}
Comment

PREVIOUS NEXT
Code Example
Php :: how to fetch days old records php mysql 
Php :: Get a list of the arrays keys 
Php :: tinker laravel 8 
Php :: php declare variable 
Php :: sql query show table phpmyadmin 
Php :: status code 301 
Php :: laravel blade excerpt from body 
Php :: View [layouts.master] not found 
Php :: phpmailer doesnt work 
Php :: pre_get_posts order by title 
Php :: canany else 
Php :: php $_server 
Php :: 0 
Php :: Route pattern cannot reference variable name more than once. laravel 
Php :: php get day of week number 
Php :: woocommerce order get product weight 
Php :: how to enable auto refresh on save 
Php :: get origin for request symfony 
Php :: php else 
Php :: dynamic function name php 
Php :: while loop laravel 
Php :: laravel show method 
Php :: php sqlite last insert id 
Php :: date subtraction php 
Php :: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in 
Php :: how to create route in laravel 
Php :: php object to json 
Php :: laravel error 422 unprocessable entity 
Php :: create middleware laravel 
Php :: indirect modification of overloaded property has no effect laravel 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =