10. Form “registrasi.php”
<html>
<head>
<title>Uas PHP (ali ridho)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style3 {font-size: 24px}
-->
</style>
</head>
<body>
<table width="800" border="1" align="center">
<tr>
<td colspan="2"><img src="image/HEADER%20-%20uas%20-%20SMK%20TI.jpg" width="800" height="130"></td>
</tr>
<tr>
<td colspan="2"><div align="center"><a href="index.php">HOME</a> | <a href="berita.php">BERITA</a> | NEWS | TUTORIAl | INFO </div></td>
</tr>
<tr>
<td width="600" height="400" valign="top"><form name="form1" method="post" action="proses_registrasi.php">
<table width="386" border="0" align="center">
<tr>
<th width="96" rowspan="7" scope="col"><img src="image/gembok.png" width="100" height="100"></th>
<th colspan="3" bgcolor="#EC5502" scope="col"><span class="style3">Sign Up </span></th>
</tr>
<tr>
<td width="96">Nama</td>
<td width="9">:</td>
<td width="167"><input name="userid" type="text" id="userid"> </td>
</tr>
<tr>
<td>Pass</td>
<td>:</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td>confirm Pass </td>
<td>:</td>
<td><input name="c_password" type="password" id="c_password"></td>
</tr>
<tr>
<td>Level</td>
<td>:</td>
<td><input name="level" type="text" id="level"></td>
</tr>
<tr>
<td colspan="3"><input name="radiobutton" type="radio" value="radiobutton">
Anda yakin mau daftar !!!</td>
</tr>
<tr>
<td colspan="3"><div align="center">
<input type="submit" name="Submit" value="Register">
<input name="batal" type="reset" id="batal" value="batal">
</div></td>
</tr>
</table>
<p>* harus wajib diisi, pada kolom level bisa mingisikan dengan (admin atau user) </p>
</form></td>
<td width="200" valign="top"><form action="log.php?op=in" method="post">
<table width="200" border="0">
<tr bgcolor="#EC5502">
<td colspan="3"><div align="center">.:: Log In ::. </div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="46">Nama</td>
<td width="10">:</td>
<td width="124"><input type="text" name="userid"></td>
</tr>
<tr>
<td>pass</td>
<td>:</td>
<td><input type="password" name="psw"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login">
<input name="batal" type="reset" id="batal" value="Batal"></td>
</tr>
<tr>
<td colspan="3">belum punya akun daftar <a href="registrasi.php">disini </a>!</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="2"><div align="center">Copy right © SMK TI 2013 By : ali ridho </div></td>
</tr>
</table>
</body>
</html>
11. Form “proses_registrasi.php”
<html>
<head>
<title>Uas PHP (ali ridho)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="800" border="1" align="center">
<tr>
<td colspan="2"><img src="image/HEADER%20-%20uas%20-%20SMK%20TI.jpg" width="800" height="130"></td>
</tr>
<tr>
<td colspan="2"><div align="center"><a href="index.php">HOME</a> | <a href="berita.php">BERITA</a> | NEWS | TUTORIAl | INFO </div></td>
</tr>
<tr>
<td width="600" height="400" valign="top"><?php
include "conn.php";
$userid = $_POST['userid'];
$password = $_POST['password'];
$c_password = $_POST['c_password'];
$level = $_POST['level'];
if($password != $c_password)
{
print "<script>alert('Konfirmasi password harus sama dengan password !');
javascript:history.go(-1);</script>";
exit;
}
if((!empty($userid)) && (!empty($password)) && (!empty($level)))
{
$query = mysql_query("INSERT INTO tabeluser (userid,password,level)
values ('$userid','$password','$level');");
print "Selamat anda berhasil Registrasi akun anda pada belajar bareng SMK TI dengan success<br><a href=index.php><font color=blue>Back to
Home</font></a>";
}
else
{
print "<script>alert('Maaf, tidak boleh ada field yang kosong !');
javascript:history.go(-1);</script>";
}
?> </td>
<td width="200" valign="top"><form action="log.php?op=in" method="post">
<table width="200" border="0">
<tr bgcolor="#EC5502">
<td colspan="3"><div align="center">.:: Log In ::. </div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="46">Nama</td>
<td width="10">:</td>
<td width="124"><input type="text" name="userid"></td>
</tr>
<tr>
<td>pass</td>
<td>:</td>
<td><input type="password" name="psw"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login">
<input name="batal" type="reset" id="batal" value="Batal"></td>
</tr>
<tr>
<td colspan="3">belum punya akun daftar <a href="registrasi.php">disini</a> !</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="2"><div align="center">Copy right © SMK TI 2013 By : ali ridho </div></td>
</tr>
</table>
</body>
</html>
12. Form “homeuser.php”
<?php
session_start();
//cek apakah user sudah login
if(!isset($_SESSION['userid'])){
die("Anda belum login");//jika belum login jangan lanjut..
}
//cek level user
if($_SESSION['level']!="user"){
die("Anda bukan user");//jika bukan user jangan lanjut
}
?>
<head>
<title>Uas PHP (ali ridho)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="800" border="1" align="center">
<tr>
<td colspan="2"><img src="image/HEADER%20-%20uas%20-%20SMK%20TI.jpg" width="800" height="130"></td>
</tr>
<tr>
<td colspan="2"><div align="center"> PROFILE | USER </div></td>
</tr>
<tr>
<td width="600" height="400" valign="top"><p>Selamat Datang di akun USER belajar bareng SMK TI.</p>
</td>
<td width="200" valign="top"><?php echo "<h3>Welcome ".$_SESSION['userid']."</h3>";?>
<p><a href=log.php?op=out>Log Out</a>
</p>
</tr>
<tr>
<td colspan="2"><div align="center">Copy right © SMK TI 2013 By : ali ridho </div></td>
</tr>
</table>
</body>
</html>

+ comments + 1 comments
mas,kira-kira untuk homeadmin dan homeuser ada databasenya nggak?
Post a Comment