you'd better use cookie to do it.
example code
PHP Code:
<?php

//get their ip address
    
if (getenv("HTTP_CLIENT_IP")) $ip getenv("HTTP_CLIENT_IP");
    else if(
getenv("HTTP_X_FORWARDED_FOR")) $ip getenv("HTTP_X_FORWARDED_FOR");
    else if(
getenv("REMOTE_ADDR")) $ip getenv("REMOTE_ADDR");
    else 
$ip "0.0.0.0";
$cvip str_replace(".","_",$ip);
$timestamp time();
if(empty(
$HTTP_COOKIE_VARS[$cvip])&&empty($_COOKIE[$cvip])){
    
setcookie($cvip,$cvip,$timestamp+24*60*60);
    echo 
"welcome to our site, your ip is ".$ip;
}else
{
    echo 
"you have visited: ".$ip;
}
?>