Daftar dan Belajar Sekarang!

Captcha tidak berfungsi pada login

foto Obbytokun
127 Kontribusi 7 Coto
1 bulan yang lalu
selamat pagi semoga di lancarkan ibadah puasa nya .. ane ada masalah di login... jadi logika captcha nya tidak terbaca.... jadi meskipun captcha salah tetep login. index.php
<form class="login100-form validate-form" method="post" action="check_login.php">
          <?php
    if(isset($_SESSION['gagal'])){
      echo '<div class="alert alert-danger alert-dismissible">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
    <strong>Incorrect username or password  </strong> please try again!
  </div>' ;
      unset($_SESSION['gagal']);
        }
        ?>
        <?php
    if(isset($_GET['pesan'])){
		if($_GET['pesan']=="salah"){
				echo '<div class="alert alert-danger alert-dismissible">
    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
    <strong>Captch salah  </strong> please try again!
  </div>' ;
      
		}
     }
        ?>
       
        <div class="wrap-input100 validate-input m-b-26" data-validate="Username is required">
            <span class="label-input100">Username</span>
            <input class="input100" type="text" name="username" placeholder="Masukkan username">
            <span class="focus-input100"></span>
          </div>

          <div class="wrap-input100 validate-input m-b-18" data-validate = "Password is required">
            <span class="label-input100">Password</span>
            <input class="input100" type="password" name="password" placeholder="Enter password">
            <span class="focus-input100"></span>
          </div>

          <div class="wrap-input100 validate-input m-b-18" data-validate = "cannot be empty">
			  <span class="label-input100">Captcha</span>
          <img src="captcha.php" alt="gambar" /> 
          <input class="input100 " type="text" name="nilaiCaptcha" placeholder="Verification">
    
          </div>
          <div class="container-login100-form-btn">
            <button class="login100-form-btn" name="submit_login">Login</button>
          </div>
        </form>
      </div>
    </div>
  </div>
cek_login.php
<?php

ob_start();
session_start();

include "koneksi.php";

/* PROSES LOGIN */
if(isset($_POST['submit_login'])) {
  $username = $_POST['username'];
  $password = $_POST['password'];
  $password = md5($password)."0";

  if($_SESSION['code']!=$_POST["nilaiCaptcha"]){
  header("location:index.php?pesan=salah");
}else{
	header("location: pages/index.php");
 }
 if(!ctype_alnum($username) or !ctype_alnum($password)){

}else{
  $sql_login = mssql_query("SELECT * FROM appl_user WHERE AU_ID = '$username' AND AU_PWD = '$password'");

  if(mssql_num_rows($sql_login)>0) {
    $row_akun = mssql_fetch_array($sql_login);
    $_SESSION['uid']=$row_akun['AU_ID'] ;
    $_SESSION['grp']=$row_akun['AU_GID'];
    $_SESSION['namaLog']=$row_akun['AU_Name'];

    $_SESSION['status'] = "login";
    $_SESSION['username'] = $row_akun['username'];
    header("location: pages/index.php");
  }else {
    $_SESSION['gagal'] = "gagal";
    header("location: index.php");
  }
}
}

?>

Tag: php



Login untuk diksusi di forum sekolah koding