Looking for somewhere to host your site? Browse our PHP web hosts section!

Home > Code Snippets > Visitor information

Visitor information

Description

Displays information about a visitor to a web page. Shows IP address, referrer and browser type.

The code


<?php


/**
 * Add this line of code in your page:
 * <?php include "visitor_information.php"; ?>
 */

// Display IP address
echo "<p>IP Address: " $_SERVER['REMOTE_ADDR'] . "</p>";

// Display the referrer
echo "<p>Referrer: " $_SERVER['HTTP_REFERER'] . "</p>";

// Display browser type
echo "<p>Browser: " $_SERVER['HTTP_USER_AGENT'] . "</p>";

?> 

Get the code

Download the file to your computer: Click here to get the file