<?php
global $con;
	$con = mysqli_connect("localhost", "root", "");
	if (!$con) {
		die("database connect problem");
	}
	$db_use = mysqli_select_db($con, "p1d3ti04_pondokedo") or die("selet db problem !!");
	
	function execQ($strQ){
		global $con;
		
		$res = mysqli_query($con,$strQ);
	
		return $res;		
	}
	function closeConn()
	{
		global $con;
		
		$res = mysqli_close($con);
		
		return $res;
	}
function getUser($username,$password)	{
		$strQ = "SELECT * FROM member WHERE username='".$username."' AND password='".$password."'";
		$resUsr = execQ($strQ);
		
		if (mysqli_num_rows($resUsr) > 0) {
			return $resUsr;
		}else{
			return NULL;
		}
	}
	function getAdmin($username,$password)	{
		$strQ = "SELECT * FROM admin WHERE username='".$username."' AND password='".$password."'";
		$resAdm = execQ($strQ);
		if (mysqli_num_rows($resAdm) > 0) {
			return $resAdm;
		}else{
			return NULL;
		}
	}
?>