daily pastebin goal
45%
SHARE
TWEET

cek login

a guest Apr 29th, 2017 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include "../config/koneksi.php";
  3. function anti_injection($data){
  4.   $filter = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data,ENT_QUOTES))));
  5.   return $filter;
  6. }
  7.  
  8. $username = anti_injection($_POST['username']);
  9. $pass     = anti_injection(md5($_POST['password']));
  10.  
  11. // pastikan username dan password adalah berupa huruf atau angka.
  12. if (!ctype_alnum($username) OR !ctype_alnum($pass)){
  13.   echo "Sekarang loginnya tidak bisa di injeksi lho.";
  14. }
  15. else{
  16. $login=mysql_query("SELECT * FROM users WHERE username='$username' AND password='$pass' AND blokir='N'");
  17. $ketemu=mysql_num_rows($login);
  18. $r=mysql_fetch_array($login);
  19.  
  20. // Apabila username dan password ditemukan
  21. if ($ketemu > 0){
  22.   session_start();
  23.  
  24.   $_SESSION[namauser]     = $r[username];
  25.   $_SESSION[namalengkap]  = $r[nama_lengkap];
  26.   $_SESSION[passuser]     = $r[password];
  27.   $_SESSION[sessid]       = $r[id_session];
  28.   $_SESSION[leveluser]    = $r[level];
  29.  
  30.   header('location:media.php?module=home');
  31. }
  32. else{
  33.  
  34.    echo "
  35.  <link href='css/zalstyle.css' rel='stylesheet' type='text/css'>";
  36.  
  37.   echo "
  38.  </head>
  39.  <body class='special-page'>
  40.  <div id='container'>
  41.  <section id='error-number'>
  42.  
  43.  <img src='img/lock.png'>
  44.  <h1>LOGIN GAGAL</h1>
  45.  
  46.  <p><span class style=\"font-size:14px; color:#ccc;\">Username atau Password anda tidak sesuai.<br>
  47.  Atau akun anda sedang diblokir.</p></span><br/>
  48.  
  49.  </section>
  50.  
  51.  <section id='error-text'>
  52.  <p><a class='button' href='index.php'>&nbsp;&nbsp; <b>ULANGI LAGI</b> &nbsp;&nbsp;</a></p>
  53.  </section>
  54.  </div>";
  55.  
  56. }
  57. }
  58. ?>
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