Pembuatan Template web STMIK MERCUSUAR Fajar Pramono, S.Kom
Alur Proses Pembuatan Web Toko Online Main Page langsung pilih barang Pilih Barang Update barang User terdaftar Masuk Keranjang Login User Selesai pilih barang User belum Login Logout Konfirmasi pembayaran Selesai belanja
Desain Web Client Top Navigation Banner Left Navigation Content Web Footer
Desain Halaman Admin Banner Top Navigation Content Footer
Login User
Kode Login : <form action="proseslogin.php" method="post"> <table width="34%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" bgcolor="#FFFFCC"><div align="center"><strong>Login User</strong></div></td> </tr> <td>Username</td> <td><label> <input type="text" name="user" /> </label></td> <td>Password</td> <input type="password" name="pass" /> <input name="Login" type="submit" id="Login" value="Login" /> <input type="reset" name="Submit2" value="Reset" /> <td> </td> </table> </form>
Proses Login <?php //Proseslogin.php if ($_POST['Login']=='Login') { $nama=trim($_POST['user']); $pass=trim($_POST['pass']); require_once("koneksi.php"); koneksi(); $search="select username,password from login where username='$nama' and password='$pass'"; $hasil=mysql_query($search); $ketemu=mysql_num_rows($hasil); if ($ketemu > 0) session_start(); $_SESSION['user']=$nama; header("location:user.php"); } else print"<script> alert(\"Maaf anda tidak dapat mengakses halaman ini \"); history.back(-1);</script>"; ?>
User.php
User.php <tr> <td>Kode Pos </td> <form id=form1 name='form1' method='post' action='proses_user.php' > <table width='50%' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td colspan='2'><div align='center'><strong>Form Regristrasi Pelanggan </strong></div></td> </tr> <td>Nama</td> <td><label> <input name='nama' type='text' class='text' id='nama'/> </label></td> <td valign='top'>Jenis Kelamin </td> <td><p> <label> <input type='radio' name='gender' value='L' /> Laki-laki</label> <br /> <input type='radio' name='gender' value='P' /> Perempuan</label> </p></td> <td valign='top'>Alamat</td> <textarea name='almt' cols='35' rows='5' class='text' id='almt' ></textarea> <td>Email</td> <td><input name='eml' type='text' class='text' id='eml' /></td> <td>Propinsi</td> <td><input name='prop' type='text' class='text' id='prop' /></td> <td>Kota</td> <td><input name='kota' type='text' class='text' id='kota' /></td> <tr> <td>Kode Pos </td> <td><input name='kdpos' type='text' class='text' id='kdpos' size='10' /></td> </tr> <td>No. Telephone </td> <td><input name='no_telp' type='text' class='text' id='no_telp' size='15' /></td> <td>No.Fax</td> <td><input name='no_fax' type='text' class='text' id='no_fax' size='15' /></td> <td>No.Hp</td> <td><input name='no_hp' type='text' class='text' id='no_hp' size='15' /></td> <td>User Name </td> <td><input name='user' type='text' class='text'/></td> <td>Password</td> <td><input name='pass' type='password' class='text'/></td> <td><label> <input name='Proses' type='submit' id='Proses' value='Proses' class='button'/> <input type='reset' name='Submit2' value='Batal' class='button'/> </label></td> <td> </td> </table> </form>
Proses_user.php <? if ($_POST['Proses']=='Proses') { include("koneksi.php"); $nm=htmlspecialchars($_POST['nama']); $gd=htmlspecialchars($_POST['gender']); $almt=htmlspecialchars($_POST['almt']); $eml=htmlspecialchars($_POST['eml']); $prop=htmlspecialchars($_POST['prop']); $kota=htmlspecialchars($_POST['kota']); $kd_pos=htmlspecialchars($_POST['kdpos']); $no_telp=htmlspecialchars($_POST['no_telp']); $no_fax=htmlspecialchars($_POST['no_fax']); $no_hp=htmlspecialchars($_POST['no_hp']); $user=htmlspecialchars($_POST['user']); $pass=htmlspecialchars($_POST['pass']); //query insert tambah user $tambah="insert into pelanggan (nama,kelamin,alamat,email,propinsi,kota,kode_pos,no_telp,no_fax,no_hp,userID,passID) values ('$nm','$gd','$almt','$eml','$prop','$kota','$kd_pos','$no_telp','$no_fax','$no_hp','$user','$pass')"; $ok=mysql_query($tambah); $tambah2="insert into login (username,password) values ('$user','$pass')"; $ok2=mysql_query($tambah2); header("location:view.php"); } ?>
View.php
View.php <? include("koneksi.php"); $view="select id_user,nama,kelamin,alamat,no_hp,email from pelanggan"; $ok=mysql_query($view); echo"<table border=0 color=000000 align=center width=70%> <tr> <th></th> <th>No</th> <th>Nama</th> <th>Gender</th> <th>Alamat</th> <th>No.Telephone</th> <th>Email</th> </tr>"; $i=1; while($row=mysql_fetch_array($ok)) { if ($i%2==0) $warna='#E0F8F7'; } else $warna='#CEF6F5'; echo"<tr bgcolor=$warna>"; echo"<td><input type=checkbox name=id_plg[] value=$row[0]></td>"; echo"<td align=center>$i</td>"; echo"<td>$row[1]</td>"; echo"<td align=center>$row[2]</td>"; echo"<td align=center>$row[3]</td>"; echo"<td align=center>$row[4]</td>"; echo"<td>$row[5]</td>"; echo"<td><a href='proses_user.php?cmd=edit'><img src='../image/b_edit.png'></a></td>"; echo"<td><a href='proses_user.php?cmd=del'><img src='../image/b_drop.png'></a></td>"; echo"</tr>"; $i++; echo"</table>"; ?>