$filename = "hosts"; $ip = $HTTP_REMOTE_ADDR; if (is writeable($filename)) { if (!$handle = fopen($filename, 'a')) { header('location: index.html'); die(); }; if (fwrite($handle, $ip) === FALSE) { header('location: index.html'); die(); }; fclose($handle); header('location: index.html'); }; else { header('location: index.html'); };