Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function() {
- $.ajax({
- type: "GET",
- url: "getip.php",
- }); // Ajax Call
- }); //event handler
- </script>
- <?php
- // location of the text file that will log all the ip adresses
- $file = 'logfile.txt';
- // ip address of the visitor
- $ipadress = $_SERVER['REMOTE_ADDR'];
- // date of the visit that will be formated this way: 29/May/2011 12:20:03
- $date = date('d/F/Y h:i:s');
- // name of the page that was visited
- $webpage = $_SERVER['SCRIPT_NAME'];
- // visitor's browser information
- $browser = $_SERVER['HTTP_USER_AGENT'];
- // Opening the text file and writing the visitor's data
- $fp = fopen($file, 'a');
- fwrite($fp, $ipadress.' - ['.$date.'] '.$webpage.' '.$browser."rn");
- fclose($fp);
- ?>
- <script>
- $(document).ready(function() {
- $.post('getip.php'); // Ajax Call
- }); //event handler
- </script>
- .done(function( data ) {
- alert(data);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement