md5

Rheyank Iwan Nytt · Feb 17, 2013
mas mw nanya ne ,,,
misal nama, kelas, alamat, username dan password ...
gmn caranya ketika qta input data diatas ,,, passwordnya tu otomatis tersimpan jdi md5 pda dtabasenya ???
gmn mas ????

ne script input q
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>English Lesson Of Grammar</title>
<link href="css/rheyank_style.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">

/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script type="text/javascript">

ddsmoothmenu.init({
	mainmenuid: "menu", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>
<style type="text/css">
<!--
.style1 {color: #75a62c}
.style2 {
	color: #333;
	font-weight: bold;
}
-->
</style>
</head>
<body>

<div id="body">
	<div id="header"></div> 
	<!-- end of header -->
    
    <div id="menu" class="ddsmoothmenu"></div>
	<!-- end of menu -->

    <div id="main">    	
	    <h2>Masukan Data Diri Anda !!! </h2>
        <div class="col_2 float_l">
            <br class="cleaner h20" />
            <div id="data_form">
			<form action="simpansiswa.php" method="post" NAME="input">

                        <label for="id">ID</label> <input type="text" id="id" name="id" class="input" />
                        <div class="cleaner h10"></div>                     
                        <label for="nama">Nama</label> <input type="text" id="nama" name="nama" class="input" />
                        <div class="cleaner h10"></div>
                        <label for="kelas">Kelas</label> <input type="text" id="kelas" name="kelas" class="input" />
                        <div class="cleaner h10"></div>
                        <label for="alamat">Alamat</label> <input type="text" id="alamat" name="alamat" class="input" />
                        <div class="cleaner h10"></div>
                        <label for="username">Username</label> <input type="text" id="username" name="username" class="input" />
                        <div class="cleaner h10"></div>
						<label for="password">Password</label> <input type="password" id="password" name="password" class="input" />
                        <div class="cleaner h10"></div>
                               
                        <input type="submit" value="Daftar" id="submit" name="submit" class="submit_btn float_l" />
						<input type="reset" value="Reset" id="reset" name="reset" class="submit_btn float_r" />
                        
            	</form>
            </div> 
        </div>
		        <div class="col_2 float_l">
        
        	<h4 class="style1">Petunjuk ..</h4>
			<p align="justify">Sebelum anda mengakses Aplikasi ini, Anda diharuskan untuk mengisi data diri anda pada form yang ada disebelah kiri tersebut. Setelah itu tekan <span class="style2">&quot;Daftar&quot;</span>. Maka anda akan dapat mengakses aplikasi ini dengan bebas kapanpun. </p>
			<p align="justify">Jika anda sudah terdaftar, silakan <span class="style2">&quot;Login&quot;</span> untuk mengakses aplikasi ini.</p>
			<p align="justify">terdapat materi yang dapat dibaca, dan didownload. Terdapat juga soal latihan untuk mengukur kemampuan anda mengenai materi grammar. </p>
			<p align="justify">Selamat mencoba !!! </p>
                     <div class="cleaner h10"></div>
					 
	<form method="post" action="login.php">
    <table width="329" height="198" border="0" align="center" background="backgroud.png">
    <tr>
      <th width="24" rowspan="3" scope="row">&nbsp;</th>
      <th height="35%" colspan="3" scope="row">&nbsp;</th>
      <td width="22" rowspan="3">&nbsp;</td>
    </tr>
    <tr>
      <th width="85" height="45" scope="row"> <div align="left">Username</div></th>
      <td width="15">:</td>
      <td width="161">
        <input type="text" name="username" />      </td>
      </tr>
    <tr>
      <th height="47" scope="row"><div align="left">Password</div></th>
      <td>:</td>
      <td><input type="password" name="password" /></td>
      </tr>
    <tr>
      <th height="45" colspan="5" scope="row">
         <input type="submit" name="Submit" value="Login" />  
        <input name="reset" type="reset" value="Reset" /></th>
      </tr>
    <tr>
      <th height="27" colspan="5" scope="row">&nbsp;</th>
    </tr>
  </table>
  </form>
            <a href="#" class="more">Lanjut</a>
   
        </div>
        
		        <br class="cleaner" />
    </div> <!-- end of main -->
    
    <div id="footer"></div>       		
        <div class="cleaner"></div>
</div> <!-- end of footer -->

<div id="cr_bar_wrapper">
	<div id="cr_bar">
    	Copyright © 2013 Designed by <a href="http://www.facebook.com/rheyank.iwan">Rheyank Iwan</a>    </div>
</div>

</body>
</html>

trs ne script simpannya mas ,,
<?
//Cek Tombol 
if ($_POST){
//Kirimkan Variabel
$id = $_POST['id'];
$nama = $_POST['nama'];
$kelas = $_POST['kelas'];
$alamat = $_POST['alamat'];
$username = $_POST['username'];
$password = $_POST['password'];

//validasi data jika pesan kosong
if (empty($_POST['id'])|| empty($_POST['nama'])|| empty($_POST['kelas'])|| empty($_POST['alamat'])|| empty($_POST['username'])|| empty($_POST['password'])) 
{
?>
<script language="JavaScript">
alert('Data Harap Dilengkapi');
document.location='inputsiswa.php';
</script>
<?
}
//Jika Validasi Terpenuhi
else
{
//Memanggil File Koneksi Database
mysql_connect("localhost", "root", "12345");
mysql_select_db("english");

//Masukan data ke Table user
     $query ="INSERT INTO user VALUES('$id','$nama','$kelas','$alamat','$username','$password')";
     $hasil = mysql_query($query);  
     if($hasil){  
//Jika Sukses
//echo "Data telah diinput";
?>
<script language="JavaScript">
alert('Data Berhasil diinput');
document.location='index.php';
</script>
<?

}
else
{
//Jika Gagal
//echo "Data gagal diinput, Silakan Ulangi";
}
}
}
?>
<script language="JavaScript">
alert('Data Gagal diinput,, Silakan ulangi');
document.location='inputsiswa.php';
</script>

tlong ea mas ,, thanks ....
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Feb 18, 2013 · 0 Suka · 0 Tidak Suka
ganti :
$query ="INSERT INTO user VALUES('$id','$nama','$kelas','$alamat','$username','$password')";

jadi:
$query ="INSERT INTO user VALUES('$id','$nama','$kelas','$alamat','$username','".md5($password)."')";
0
Loading...
Rheyank Iwan Nytt · Feb 18, 2013 · 0 Suka · 0 Tidak Suka
mw nanya lgi mas ... disamping form input kan da form login ,, trs untuk loginnya ,, jika di kasi kategori sesuai tabelnya bsa gag mas ??? misal
tabel user
id, nama, kelas, alamat, username, password
trs tabel admin
id_user, username, password

trs kalau admin ambil dri tabel admin, kalau siswa ambil dari tabel user .....
tlong ea mas ....
0
Loading...
Ellyx Christian · Feb 20, 2013 · 0 Suka · 0 Tidak Suka
table kamu salah, hanya perlu satu
table user:
id, nama, kelas, alamat, username, password, tipe(admin atau siswa)

kemudian untuk kode kamu bisa pake referensi di
http://www.myphptutorials.com/questions/help-para-master-php-menghilangkan-hak-akses-combo-box-pada-login_1059.html