Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1
- /jquery.min.js"></script>
- <script type="text/javascript">
- $(document).bind('keypress', function(e) {
- if (e.keyCode == 116){
- validNavigation = true;
- }
- });
- // Attach the event click for all links in the page
- $("a").bind("click", function() {
- validNavigation = true;
- });
- // Attach the event submit for all forms in the page
- $("form").bind("submit", function() {
- validNavigation = true;
- });
- // Attach the event click for all inputs in the page
- $("input[type=submit]").bind("click", function() {
- validNavigation = true;
- });
- window.addEventListener("beforeunload", function (e) {
- if (!validNavigation) {
- $.ajax({
- url: 'logout.php',
- type: 'POST',
- async: false,
- timeout: 4000
- });
- }
- })
- </script>
- <?php
- $username = "root";
- $password = "";
- $hostname = "localhost";
- $dbhandle = mysql_connect($hostname, $username, $password)
- or die("Unable to connect to MySQL");
- echo "Connected to MySQL<br>";
- $selected = mysql_select_db("examples",$dbhandle)
- or die("Could not select examples");
- $result = mysql_query("DELETE FROM cars WHERE id='1'");
- mysql_close($dbhandle);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement