<?php 
ob_start();
session_start();
include('includes/config.php');
if(isset($_POST['login']))
{ 
$name=mysqli_real_escape_string($com,$_POST['name']);
$password=mysqli_real_escape_string($com,md5($_POST['password']));
if($name!='' && $password!=''){
$sql="select * from `user` where `name`='".$name."' and `password`='".$password."'";

//print_r($sql);exit;
	$result=mysqli_query($com,$sql);
	$num=mysqli_num_rows($result);
	$line=mysqli_fetch_assoc($result);
	if($num>=1)
	{
	//print_r(123);exit;
		$_SESSION['id']=$line['id'];
		$_SESSION['name']=$line['name'];
		$_SESSION['type']=$line['type'];
		$_SESSION['pass_show']=$line['pass_show'];
		header("location:dashboard.php");
	}
	else
	{
		header("location:index.php");
	}
}else{header("location:index.php");}
}
else
{
	header("location:index.php");
}
?>