Advertisement
Guest User

Untitled

a guest
Mar 8th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1
  2. /jquery.min.js"></script>
  3.  
  4. <script type="text/javascript">
  5.  
  6. $(document).bind('keypress', function(e) {
  7. if (e.keyCode == 116){
  8. validNavigation = true;
  9. }
  10. });
  11.  
  12. // Attach the event click for all links in the page
  13. $("a").bind("click", function() {
  14. validNavigation = true;
  15. });
  16.  
  17. // Attach the event submit for all forms in the page
  18. $("form").bind("submit", function() {
  19. validNavigation = true;
  20. });
  21.  
  22. // Attach the event click for all inputs in the page
  23. $("input[type=submit]").bind("click", function() {
  24. validNavigation = true;
  25. });
  26.  
  27. window.addEventListener("beforeunload", function (e) {
  28. if (!validNavigation) {
  29. $.ajax({
  30. url: 'logout.php',
  31. type: 'POST',
  32. async: false,
  33. timeout: 4000
  34. });
  35. }
  36. })
  37. </script>
  38.  
  39. <?php
  40. $username = "root";
  41. $password = "";
  42. $hostname = "localhost";
  43.  
  44. $dbhandle = mysql_connect($hostname, $username, $password)
  45. or die("Unable to connect to MySQL");
  46. echo "Connected to MySQL<br>";
  47.  
  48.  
  49. $selected = mysql_select_db("examples",$dbhandle)
  50. or die("Could not select examples");
  51.  
  52. $result = mysql_query("DELETE FROM cars WHERE id='1'");
  53. mysql_close($dbhandle);
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement