daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Jan 25th, 2016 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. if(isset($_POST['btnLogin'])){
  4.     #baca variabel form
  5.     $txtUser        = $_POST['txtUser'];
  6.     $txtUser        = str_replace("'","&acute;",$txtUser);
  7.    
  8.     $txtPassword    = $_POST['txtPassword'];
  9.     $txtPassword    = str_replace("'","&acute;",$txtPassword);
  10.    
  11.     #validasi form
  12.     $pesanError     = array();
  13.     if (trim($txtUser)==""){
  14.         $pesanError[] = "Data <b> Username </b> tidak boleh kosong !";
  15.     }
  16.     if (trim($txtPassword)==""){
  17.         $pesanError[] = "Data <b> password </b> tidak boleh kosong !";
  18.     }
  19.    
  20.     #jika ada pesan eror dari validasi
  21.     if (count ($pesanError) >=1) {
  22.         echo "<div class='mssgBox'>";
  23.         echo "<img src='images/attention.png'> <br> <hr>";
  24.             $noPesan= 0;
  25.             foreach ($pesanError as $indeks=>$pesan_tampil) {
  26.                 $noPesan++;
  27.                 echo "&nbsp;&nbsp; $noPesan.$pesan_tampil<br>";
  28.             }
  29.         echo "</div> <br>";
  30.        
  31.         //Tampilkan lagi form login
  32.         include "Login.php";
  33.     }
  34.     else{
  35.         #Login cek ke tabel user login
  36.         $loginSql = "SELECT * FROM user WHERE username='$txtUser' AND password='".md5($txtPassword)."'";
  37.         $loginQry = mysql_query ($loginSql, $koneksidb) or die ("Query Salah : ".mysql_error());
  38.        
  39.         #jika login sukses
  40.         if (mysql_num_rows($loginQry)>=1){
  41.             $loginData = mysql_fetch_array($loginQry);
  42.             $_SESSION['SES_LOGIN'] = $loginData['kode_user'];
  43.             $_SESSION['SES_ADMIN'] = "Admin";
  44.            
  45.             //refresh
  46.             echo "<meta http-equiv ='refresh' content='0; url=?open=Halaman-Utama'>";
  47.            
  48.         }
  49.     }
  50. }
  51.  
  52. //end post
  53. ?>
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