Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <script>
  2. $(document).ready(function() {
  3. $.ajax({
  4.  
  5. type: "GET",
  6. url: "getip.php",
  7.  
  8. }); // Ajax Call
  9. }); //event handler
  10. </script>
  11.  
  12. <?php
  13. // location of the text file that will log all the ip adresses
  14. $file = 'logfile.txt';
  15.  
  16. // ip address of the visitor
  17. $ipadress = $_SERVER['REMOTE_ADDR'];
  18.  
  19. // date of the visit that will be formated this way: 29/May/2011 12:20:03
  20. $date = date('d/F/Y h:i:s');
  21.  
  22. // name of the page that was visited
  23. $webpage = $_SERVER['SCRIPT_NAME'];
  24.  
  25. // visitor's browser information
  26. $browser = $_SERVER['HTTP_USER_AGENT'];
  27.  
  28. // Opening the text file and writing the visitor's data
  29. $fp = fopen($file, 'a');
  30.  
  31. fwrite($fp, $ipadress.' - ['.$date.'] '.$webpage.' '.$browser."rn");
  32.  
  33. fclose($fp);
  34. ?>
  35.  
  36. <script>
  37. $(document).ready(function() {
  38. $.post('getip.php'); // Ajax Call
  39. }); //event handler
  40. </script>
  41.  
  42. .done(function( data ) {
  43. alert(data);
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement