Pozdrav,
skinuo sam php kod koji pri posjetu stranice sprema IP adresu, datum i vrijeme u txt file, te provijerava dal vec postoji ista IP adresa da je ne ispisuje ponovno. Ovako izgleda txt file:
93.182.129.86 2012/10/27 10:58:25
Sad bi ja htio kad vec postoji ista IP adresa da joj se promijeni vrijeme i datum zadnjeg posjeta stranici a ne da ostane zapisan samo prvi posjet.
Isprobava sam izmijenjivat kod ali problem je sta nemam blage veze PHP.
Ovako izgleda PHP:
<?php
// Checks the current date and time
$dateTime = date('Y/m/d G:i:s');
// Loads the writable text file and await instruction from fwrite command
$fp = fopen('ip-log.txt', 'r+');
while (!feof($fp))
{
$buffer = fgets($fp);
// Scan for any previous logs of the IP
// If scan determines that the user is a logged IP address, overwrite existing log.
list ($ip, $crap) = split(' ', $buffer);
if ($_SERVER['REMOTE_ADDR'] == trim($ip))
$exists = TRUE;
}
// If scan determines it's user is a new IP entry, add the IP address to the log file at the end of the document
if (!$exists)
fwrite($fp, $_SERVER['REMOTE_ADDR']. " $dateTime\n");
fclose($fp);
?>