i am building a website and i hardly need to track ip addreess of visitors.
please help!

SOS

Recommended Answers

All 7 Replies

$_server[]

You can use $_SERVER to get ip address of visitors.

sorry!
but i didn't understand!

thax alot for helping me and i appreciate that

So, does your problem solve ? If then, marks as 'Solved thread' with the link under the message box.

U can use this:-

$ip=$_SERVER['REMOTE_ADDR'];

A better way to write this is using this:-

<html>
<head>
 <title>What is my IP address?</title>
</head>
<body>
<?php
 
    if (getenv(HTTP_X_FORWARDED_FOR)) {
        $pipaddress = getenv(HTTP_X_FORWARDED_FOR);
        $ipaddress = getenv(REMOTE_ADDR);
echo "Your Proxy IPaddress is : ".$pipaddress. "(via $ipaddress)" ;
    } else {
        $ipaddress = getenv(REMOTE_ADDR);
        echo "Your IP address is : $ipaddress";
    }
?>
</body>
</html>

$_SERVER returns the IP address of user

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.