Advertisement
Guest User

Untitled

a guest
Jul 10th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php session_start();
  2. include("../UAS_IS1/config.php");
  3. $user = $_POST['usertxt'];
  4. $user = str_replace("'","&acute;",$user);
  5. $psw=$_POST['pswtxt'];
  6. $psw= str_replace("'","&acute;",$psw);
  7. $cek = "Select * from tbl_pelanggan where username='".$user."' and password='".md5($psw)."'";
  8. //menyeleksi ke tabel admin username dan password berdsarkan variabel username dan password
  9. //untuk password sebelumnya telah dienkripsi dengan fungsi md5
  10. $hasil = mysql_query($cek);
  11. $hasil_cek = mysql_num_rows($hasil);
  12. //jika data tidak ditemukan maka tamplan pesan user dan psw salah
  13. if ($hasil_cek==0){
  14. header("location:index.php");
  15. //echo "Username dan Password yang Anda isi salah...!!!";
  16. }else{
  17. //jika data ditemukan maka buka halaman menu utama dan sekaligus membuka session
  18. $_SESSION['userlogin'] =$user;
  19. //echo "ada session ".$_SESSION['userlogin'];
  20. header("location:home.php");
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement