<?php
include("../../inc/koneksi.php");
require('../../inc/password.php'); 

$user = mysql_real_escape_string($_POST['username']);
$pass = mysql_real_escape_string($_POST['password']);

//cek user
$login="SELECT * FROM user WHERE username='$user'";
$cek=mysql_query($login) or die(mysql_error());
$isi=mysql_fetch_array($cek);

$wrong = "";
//cek;
if(password_verify($pass, $isi['password'])) 
{
	session_start();
	$_SESSION['username'] = $isi['username'];
	$_SESSION['nama'] = $isi['nama'];
	$_SESSION['email'] = $isi['email'];

	$user = $_SESSION['username'];
	$nama = $_SESSION['nama'];
	$email = $_SESSION['email'];
	//echo "<meta http-equiv='refresh' content='0; url=../index.php'>";
}
else
{
	$wrong = "salah";
}

if($wrong == "")
	{
		echo "<meta http-equiv='refresh' content='0; url=../index.php'>";
	}
	else
	{
		echo "<script language=\"javascript\">
			window.location='../login.php?ket=$wrong';
		</script>";	
	}
		
?>