0
Good afternoon guys, I’m trying to create a text file with the client’s IP, so let’s say the server will create a file run X action,send the file to the client for download, then delete from the server. I’m just missing to know how to create the file with the client’s ip number, my intention is that if I set a default name for the file, and multiclientes access pag, when generating the file they do not conflict, maybe there is another way to do this...
<?php
$arquivo = fopen("num_ip", "w");
$texto = "Conteúdo do cliente aqui";
fwrite($arquivo, $texto);
fclose($arquivo);
function download( $path, $fileName = '' )
{
if( $fileName == '' )
{
$fileName = basename( $path );
}
header("Content-Type: application/force-download");
header("Content-type: application/octet-stream;");
header("Content-Length: " . filesize( $path ) );
header("Content-disposition: attachment; filename=" . $fileName );
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
readfile( $path );
flush();
}
download( 'num_ip.txt', 'arquivo.txt' );
$arquivo = "num_ip.txt";
(!unlink($arquivo))
?>
Most people change their IP every day at the most varied times. Are you sure that’s what you want?
– Bacco
is temporary, meaning it doesn’t matter :D
– Jefter Rocha