Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index.php
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Timer</title>
- </head>
- <body>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
- <script>
- var start;
- $(document).ready(function() {
- start = Date.now();
- $(window).unload(function() {
- end = Date.now();
- $.ajax({
- url: 'timer.php',
- type: 'POST',
- data: {end ,start}
- })
- });
- $( window ).unload(function() {
- return "Bye now!";
- });
- }
- </script>
- <img src="baywatch.jpg" alt="baywatch" />
- <?php
- echo("<p><a href='timer.php'>Voir time Spent</a></p>");
- ?>
- </body>
- </html>
- timer.php
- <?php
- include('cnx.php');
- $v2=$_POST['end'];
- $v3=$_POST ['start'];
- echo $v2;
- echo $v3;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement