In systems for managing Internet resources, which can be used by both authorized users and unregistered visitors, scripts refer the latter to a separate group. In most cases, this group of unregistered site users is called "Guests" in the control panel. While determining the IP address of authorized visitors is usually a standard scripting function, then for the Guests group, retrieving this parameter may not be so easy.
Instructions
Step 1
If the display of the IP address of an unauthorized user of a chat, forum, blog or other similar web resource is provided by the manufacturer of the scripts that this resource is based on, you just need to enable the desired option. It is disabled by default to save web server resources. Look for this setting in the control system settings. If you cannot find it yourself, read the description, contact the support service of the script manufacturer, or ask a question on the user forum of your system.
Step 2
The script may not have such a setting, but if the function of determining the IP address is used in its internal operations, you can try to use it for your purposes. To do this, you will need to make changes to the system code, so you will need some skills in working with the source codes of modules in site management systems or server-side programming languages - usually such scripts are written in PHP. Open the source code of the page where you want to see the guest's IP address, define a variable containing the desired value and place it in the correct location. For example, in the widely used UCOZ control system, to display this value, insert the code $ _IP_ADDRESS $ into the page.
Step 3
As a last resort, you can use your own PHP function to determine the IP address. This option is suitable for systems that allow you to insert code in this language into pages. Of course, this method will require an even greater level of knowledge of the language. You will have to program the output to the IP-address page yourself, and the function for determining it may look like this:
function getIPaddress () {
$ guestIP = getenv ('HTTP_CLIENT_IP') or $ guestIP = getenv ('HTTP_X_FORWARDED_FOR') or $ guestIP = getenv ('REMOTE_ADDR');
return trim (preg_replace ('# ^ ([^,] +) (,. *)? #', '$ 1', $ guestIP));
}