<?php
include"../inc/conn.php";
$username1 = mysqli_real_escape_string($connect,$_POST['username']);
$password1 = mysqli_real_escape_string($connect,$_POST['password']);
	
$username 	= str_replace("'","`",$username1);
$password 	= str_replace("'","`",$password1);



	$qcek=mysqli_query($connect,"select * from tb_siswa where username='$username' AND password='$password'") or die(mysqli_error());
	$hasilcek=mysqli_num_rows($qcek);
	$rcek=mysqli_fetch_array($qcek);
	if($hasilcek>0){
		session_start();
		$_SESSION['id_siswa']			= $rcek['id_siswa'];
		$_SESSION['status']				= 'SISWA';

		echo "1";
	}else{
		echo "2";
	}

?>