Skip to content

Instantly share code, notes, and snippets.

@FreeFly19
Created March 30, 2016 18:48
Show Gist options
  • Save FreeFly19/5cc80b8f637e065d4800355d1800e2f4 to your computer and use it in GitHub Desktop.
Save FreeFly19/5cc80b8f637e065d4800355d1800e2f4 to your computer and use it in GitHub Desktop.
Get user ip and put to file
Hello, dear user :)
<?php
$date = date("Y-m-d H:i:s");
$userIp = $_SERVER['REMOTE_ADDR'];
$lastLineInFile = "[$date] $userIp\r\n";
$file = fopen("file.txt", "a+");
fwrite($file, $lastLineInFile);
fclose($file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment