Advertisement
Guest User

Untitled

a guest
Jan 21st, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. index.php
  2.  
  3.  
  4.  
  5.  
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8.  
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  11.  
  12. <title>Timer</title>
  13.  
  14. </head>
  15.  
  16. <body>
  17. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  18.  
  19. <script>
  20. var start;
  21. $(document).ready(function() {
  22. start = Date.now();
  23.  
  24. $(window).unload(function() {
  25. end = Date.now();
  26. $.ajax({
  27. url: 'timer.php',
  28. type: 'POST',
  29. data: {end ,start}
  30.  
  31. })
  32. });
  33. $( window ).unload(function() {
  34. return "Bye now!";
  35. });
  36. }
  37.  
  38. </script>
  39.  
  40.  
  41. <img src="baywatch.jpg" alt="baywatch" />
  42. <?php
  43.  
  44. echo("<p><a href='timer.php'>Voir time Spent</a></p>");
  45. ?>
  46.  
  47. </body>
  48. </html>
  49.  
  50.  
  51.  
  52.  
  53.  
  54. timer.php
  55.  
  56. <?php
  57. include('cnx.php');
  58.  
  59. $v2=$_POST['end'];
  60. $v3=$_POST ['start'];
  61.  
  62. echo $v2;
  63. echo $v3;
  64.  
  65.  
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement