nebukad

data_user.php

Feb 17th, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php
  2. include'../koneksi.php';
  3. if(!isset($_SESSION['user']) || !isset($_SESSION['password'])){
  4.         header('location:index.php');
  5. }else{
  6.         $sql=mysql_query("select*from user");
  7. }
  8. ?>
  9. <html>
  10. <head>
  11. <title>Data User</title>
  12. <link rel="stylesheet" type="text/css" href="style.css">
  13. </head>
  14. <body>
  15.     <table border="1" align="center" width="600">
  16.         <tr>
  17.             <th>USER ID</th>
  18.             <th>USERNAME</th>
  19.             <th>PASSWORD</th>
  20.             <th>HAK AKSES</th>
  21.             <th colspan="2">AKSINYA</th>
  22.         </tr>
  23.     <?php
  24.     $no=1;
  25.     while($aray=mysql_fetch_array($sql)){
  26.         if($aray['hak_akses']==1){
  27.             $hak="ADMINISTRATOR";
  28.         }else{
  29.             $hak="USER";
  30.         }
  31.     ?>
  32.         <tr bgcolor="#00ffff">
  33.             <td><?=$aray['id_user'];?></td>
  34.             <td><?=$aray['username'];?></td>
  35.             <td><?=$aray['password'];?></td>
  36.             <td><?=$hak;?></td>
  37.             <td><a href="home.php?menu=user&id=<?=$aray['id_user'];?>" name="edit_user">EDIT</a></td>
  38.             <td><a href="home.php?menu=data_user&id=<?=$aray['id_user'];?>" name="edit_user">HAPUS</a></td></td>
  39.         </tr>
  40.     <?php
  41.         $id=isset($_GET['id']) ? $_GET['id'] : 0;
  42.         if($_GET['id']){
  43.             $delete=mysql_query("delete from user where id_user=$id");
  44.     ?>
  45.         <script type="javascript">
  46.                 top.location='home.php?menu=data_user';
  47.         </script>
  48.     <?php
  49.         }
  50.     }
  51.     ?>
  52.     </table>
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment