Skip to content

Instantly share code, notes, and snippets.

@udibagas
Created November 29, 2017 09:23
Show Gist options
  • Save udibagas/7524bc392cfdfbc605eac954d0d6dfa4 to your computer and use it in GitHub Desktop.
Save udibagas/7524bc392cfdfbc605eac954d0d6dfa4 to your computer and use it in GitHub Desktop.
<?php
include "../koneksi.php";
@session_start();
$username = mysqli_real_escape_string($konek, $_POST['username']);
$password = mysqli_real_escape_string($konek, $_POST['password']);
$password = md5($password);
$sql = "SELECT * FROM register WHERE email='$username' AND password='$password' AND status='Y'";
$result = $konek->query($sql);
$num_row = $result->num_rows;
if( $num_row > 0 ) {
$row=$result->fetch_assoc();
$_SESSION['username']=$row['nama'];
$_SESSION['level']=$row['level'];
$_SESSION['id_req']=$row['id_register'];
echo 1; // BARIS INI YANG DIUBAH, TADINYA 'true' ubah jadi 1
} else {
echo 0; // BARIS INI YANG DIUBAH, TADINYA 'false' ubah jadi 0
}
$konek->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment