Senin, 08 Juni 2015

user

Edit Posted by with No comments
<?php
$koneksi = mysql_connect("localhost", "root", "") or die("Gagal koneksi ke server.");
mysql_select_db("warnas") or die("Gagal membuka database.");
?>
<html>
<head>
</head>
<body>
<tr>
        <td><div align="center">
          <p><a href="form_user.php">Form User</a>          </p>
          <table width="800" border="1" align="center">
            <tr>
      <td width="104" align="center">Id User</td>
      <td width="168" align="center">Username</td>
      <td width="112" align="center">Level User</td>
      <td width="108" align="center">Password</td>
 <td width="100" align="center">Email</td>
      <td width="95" align="center">Phone</td>
 <td width="100" align="center">Address</td>
      <td width="95" align="center">Status</td>
 <td width="95" align="center">Action</td>
    </tr>
<?php
$query = "select * from tb_user";
$hasil = mysql_query($query, $koneksi) or die("Gagal melakukan query.");
while ($buff = mysql_fetch_array($hasil)) {
?>
    <tr>
      <td><?php echo $buff['id_user']; ?></td>
      <td><?php echo $buff['username']; ?></td>
      <td><?php echo $buff['level_user']; ?></td>
      <td><?php echo $buff['password']; ?></td>
 <td><?php echo $buff['email'];?></td>
 <td><?php echo $buff['phone'];?></td>
 <td><?php echo $buff['address'];?></td>
 <td><?php echo $buff['status'];?></td>
      <td align="center">
    <a href="edit_user.php?id_mobil=<?php echo $buff['id_user']; ?>">Edit</a>
<a href="hapus_user.php?id_mobil=<?php echo $buff['id_user']; ?>">Hapus</a></td>
    </tr>
<?php
};
mysql_close($koneksi);
?>
</body>
</html>

contoh form input user

Edit Posted by with No comments
<html>
<head>
<title></title>
</head>

<body>
<h1>Form Input User</h1>

<form name="form_user" action="data_user.php" method="post">
<table border="0" cellpadding="5" cellspacing="0">
    <tbody>
        <tr>
            <td>Username</td>
            <td>:</td>
            <td><input type="text" name="username" /></td>
        </tr>
<tr>
            <td>Level_User</td>
            <td>:</td>
            <td><input type="text" name="level_user"  /></td>
        </tr>
        <tr>
            <td>Password</td>
            <td>:</td>
            <td><input type="password" name="password"  /></td>
        </tr>
        <tr>
            <td>Email</td>
            <td>:</td>
            <td><input type="text" name="email"  /></td>
        </tr>
        <tr>
            <td>Phone</td>
            <td>:</td>
            <td><input type="text" name="phone" /></td>
        </tr>
        <tr>
            <td>Address</td>
            <td>:</td>
            <td><input type="text" name="address"  /></td>
        </tr>
    <tr>
            <td>Status</td>
            <td>:</td>
            <td><input type="text" name="status"  /></td>
        </tr>
        <tr>
            <td align="right" colspan="3"><input type="submit" name="submit" value="Simpan" /></td>
        </tr>
    </tbody>
</table>
</form>
</body>
</html>

halaman

Edit Posted by with No comments
index

<html>
<head>
<title>Halaman Administrator</title>
</head>

<body>
<table width="1024" border="1" align="center">
  <tr>
    <td height="137"><table width="100%" border="0">
      <tr>
        <td><img src="images/rental1_01.jpg" width="1024" height="268" /></td>
      </tr>
      <tr>
        <td><div align="center">
<h3>SELAMAT DATANG</h3>
<p>&nbsp;</p>
<p>&nbsp;</p>
        </div></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

======================================

admin

<html>
<head>
<title>Halaman Administrator</title>
</head>

<body>
<table width="1024" border="1" align="center">
  <tr>
    <td height="137"><table width="100%" border="0">
      <tr>
        <td><img src="images/rental1_01.jpg" width="1024" height="268" /></td>
      </tr>
      <tr>
        <td><table width="100%" border="1" align="center">
           <tr>
            <td width="16%"><div align="center"><a href="mobil.php"><h4>MOBIL</h4></a></div></td>
            <td width="23%"><div align="center"><a href="pelanggan.php"><h4>PELANGGAN</h4></a></div></td>
            <td width="16%"><div align="center"><a href="penyewaan.php"><h4>PENYEWAAN</h4></a></div></td>
            <td width="18%"><div align="center"><a href="pengembalian.php"><h4>PENGEMBALIAN</h4></a></div></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><div align="center">
<h1>SELAMAT DATANG DI HALAMAN ADMIN</h1>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="index.php">
  <input type="submit" name="button" id="button" value="Logout" />
</form>
<p>&nbsp;</p>
        </div></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>

</html>

delete

Edit Posted by with No comments
<html>
<head>
<title>Hapus</title>
</head>
<?php
$koneksi = mysql_connect("localhost", "root", "") or die("Gagal konek ke server.");
mysql_select_db("rental") or die("Gagal membuka database.");
$id_mobil = $_GET['id_mobil'];
mysql_query("delete from mobil where id_mobil='$id_mobil'") or die("Gagal menghapus data.");
mysql_close($koneksi);
?>
<p>Data telah dihapus. Silakan dicek di <a href="mobil.php">mobil.php</a></p>
</body>
</html>

insert1

Edit Posted by with No comments
<html>
<head>
<title>Tambah</title>
</head>
<?php
$koneksi = mysql_connect("localhost", "root", "") or die("Gagal koneksi ke server.");
mysql_select_db("rental") or die("Gagal membuka database.");
$id_mobil = $_POST['id_mobil'];
$jenis_mobil = $_POST['jenis_mobil'];
$no_polisi = $_POST['no_polisi'];
$tarif_sewa = $_POST['tarif_sewa'];
$keterangan = $_POST['keterangan'];
$query = mysql_query("insert into mobil values ('$id_mobil', '$jenis_mobil', '$no_polisi' , '$tarif_sewa', '$keterangan')");
mysql_close($koneksi);
?>
<p>Data sudah tersimpan. Silakan dicek di <a href="../rental/mobil.php">mobil.php</a></p>
</body>
</html>