Advertisement
Vendettaaaa

Untitled

Jul 1st, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script>
  4.  
  5. function ask () {
  6. return confirm( "Are you sure?" ); // RETURNS TRUE OR FALSE.
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <?php
  13. require_once('usersAPI.php');
  14. error_reporting(E_ALL);
  15. ini_set('display_errors', 1);
  16. /*
  17. function tinyf_users_get($extra ='')
  18. {
  19.         global $tf_handle;
  20.         $query = sprintf("SELECT * FROM `users` %s",$extra );
  21.         $qresult = mysqli_query($tf_handle, $query);
  22.        
  23.         if (!$qresult)
  24.                 return NULL;
  25.         $recount = mysqli_num_rows($qresult);
  26.         if ($recount == 0)
  27.                 return NULL ;
  28.         $users = array();
  29.         for($i = 0 ; $i < $recount ; $i++)
  30.                 $users[count($users)] = mysqli_fetch_object($qresult); returns the current row of a result set
  31.         //mysql_free_result($qresult);
  32.        
  33.         return $users;
  34. }
  35. */
  36. $users = tinyf_users_get();
  37. if($users == NULL)
  38. {
  39.         die('problem');
  40. }
  41. $ucount = count($users);
  42. if($ucount == 0)
  43. {
  44.         die('No users');
  45. }
  46. ?>
  47.  
  48. <ul type = "square">
  49. <?php
  50. for($i = 0 ; $i < $ucount ; $i++)
  51. {
  52.         $user = $users[$i];
  53.         //echo "<li><a href = \"userProfile.php?id=$user->id\">$user->name <a/> -- $user->email -- <a href = \"deleteUser.php?id=$user->id\"> Delete <a/> | <a href = \"modifyUser.php?id=$user->id\"> edit <a/>  </li>"; //$array ->
  54.    
  55.         echo '<form method="post" action="deleteUser.php" onsubmit="return ask()">' ;
  56.               $user->name ;
  57.              '  <input type="text" name="uid" value="$user->id" hidden />' ;
  58.              '  <input type="submit" value="Delete" />' ;
  59.              '</form>';
  60.          
  61. }
  62. ?>    
  63. </ul>  
  64.  
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement