SHARE
TWEET

cek.php

a guest Jun 5th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start(); // memulai session
  3.  
  4. include "koneksi.php";
  5. $username = $_POST['username'];
  6. $pass= md5($_POST['password']);
  7. $pass_md5 = md5($pass);
  8. $sql=mysql_query("SELECT username,password,email,no_handphone,alamat_kostumer FROM tbl_kostumer
  9.                   WHERE username = '$username'
  10.                   AND password = '$pass_md5'");
  11. $data=mysql_fetch_array($sql);
  12. $email = $sql['email'];
  13.  
  14. // untuk mendeteksi apakah user tersebut memang terdaftar,
  15. // jika terdaftar, maka tidak akan menghasilkan nilai 0 (null)
  16. $hasil=mysql_num_rows($sql);
  17.  
  18. // membandingkan nilai tersebut dengan 0
  19.  if($hasil == 1){
  20.     session_start();
  21.     $_SESSION['username'] = $username;
  22.     $_SESSION['email'] = $email;
  23.     header("Location: servis.php");
  24.  }
  25.  else
  26.  {
  27.  echo "Invalid Username or Password";
  28.  }
  29.  
  30. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top