mirror of https://github.com/dnomd343/echoIP
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							17 lines
						
					
					
						
							478 B
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							17 lines
						
					
					
						
							478 B
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								function getClientIp() {
							 | 
						|
								    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
							 | 
						|
								        $ip = $_SERVER['HTTP_CLIENT_IP'];
							 | 
						|
								    } elseif (!empty($_SERVER['HTTP_X_REAL_IP'])) {
							 | 
						|
								        $ip = $_SERVER['HTTP_X_REAL_IP'];
							 | 
						|
								    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
							 | 
						|
								        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
							 | 
						|
								        $ip = preg_replace('/,.*/', '', $ip);
							 | 
						|
								    } else {
							 | 
						|
								        $ip = $_SERVER['REMOTE_ADDR'];
							 | 
						|
								    }
							 | 
						|
								    return preg_replace('/^::ffff:/', '', $ip);
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								?>
							 | 
						|
								
							 |