Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <script type="text/javascript">
  2. function show_alert()
  3. {
  4.   var r = confirm("Would you like to delete this user?");
  5.   if (r == true)
  6.   {
  7.       <?php
  8.       if(isset($_POST['user_id']) && ctype_digit($_POST['user_id']))
  9.       {
  10.  
  11.         $db = new mysqli("99.99.99.999", "99.99.99.999", "99.99.99.999", "99.99.99.999");
  12.         $statement = $db->prepare("DELETE FROM `afb2_accounts` WHERE `account_id` = '{$_POST['user_id']}' LIMIT 1");
  13.         $statement->bind_param("user_id", $_POST['user_id']);
  14.         $statement->execute();
  15.       }
  16.       ?>
  17.   }
  18.   else
  19.   {
  20.     alert("You pressed Cancel!");
  21.   }
  22. }
  23. </script>
  24.  
  25. <!-- The action -->
  26.  
  27. <form method="post">
  28. <input type="image" src="/img/delete_user32.ico" title="Delete" name="user_id" value="<?php echo $row['account_id'];?>" onclick="show_alert()"/>
  29. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement