All pastes #472240 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-05 12:48 UTC
rendered paste body
$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');
};