Pembuatan Template web STMIK MERCUSUAR Fajar Pramono S
Pembuatan Template web STMIK MERCUSUAR Fajar Pramono, S. Kom
Alur Proses Pembuatan Web Toko Online Main Page langsung pilih bara ng Pilih Barang Upd ate bar ang r fta a d er rt se Masuk Keranjang U lih Login esa i pi belu m Sel User bar ang Login User Logout Selesai bela nja Konfirmasi pembayaran
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> </tr> <td>Password</td> <td><label> <input type="password" name="pass" /> </label></td> </tr> <td><label> <input name="Login" type="submit" id="Login" value="Login" /> <input type="reset" name="Submit 2" value="Reset" /> </label></td> <td> </td> </tr> </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 <form id=form 1 name='form 1' 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> </tr> <td valign='top'>Jenis Kelamin </td> <td><p> <label> <input type='radio' name='gender' value='L' /> Laki-laki</label> <label> <input type='radio' name='gender' value='P' /> Perempuan</label> </p></td> </tr> <td valign='top'>Alamat</td> <td><label> <textarea name='almt' cols='35' rows='5' class='text' id='almt' ></textarea> </label></td> </tr> <td>Email</td> <td><input name='eml' type='text' class='text' id='eml' /></td> </tr> <td>Propinsi</td> <td><input name='prop' type='text' class='text' id='prop' /></td> </tr> <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> </tr> <td>No. Fax</td> <td><input name='no_fax' type='text' class='text' id='no_fax' size='15' /></td> </tr> <td>No. Hp</td> <td><input name='no_hp' type='text' class='text' id='no_hp' size='15' /></td> </tr> <td>User Name </td> <td><input name='user' type='text' class='text'/></td> </tr> <td>Password</td> <td><input name='pass' type='password' class='text'/></td> </tr> <td><label> <input name='Proses' type='submit' id='Proses' value='Proses' class='button'/> <input type='reset' name='Submit 2' value='Batal' class='button'/> </label></td> <td> </td> </tr> </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, user. ID, pass. ID) values ('$nm', '$gd', '$almt', '$eml', '$prop', '$kota', '$kd_pos', '$no_telp', '$no_fax', '$no_hp', '$user', '$pass')"; $ok=mysql_query($tambah); $tambah 2="insert into login (username, password) values ('$user', '$pass')"; $ok 2=mysql_query($tambah 2); 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> <th></th> </tr>"; $i=1; while($row=mysql_fetch_array($ok)) { if ($i%2==0) { $warna='#E 0 F 8 F 7'; } else { $warna='#CEF 6 F 5'; } 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>"; ? >
- Slides: 12