<?
	// WARNING : DO NOT simply return "true". By doing so, you are allowing
	// "anyone" to upload and list the files in your server. You must implement
	// some kind of session validation here. Even something very simple as...

	// return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];

	// ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
	// user logs in your system. To be able to use session variables don't
	// forget to add session_start() at the top of this file.
    $cisess_cookie = $_COOKIE['ci_session'];
    $cisess_cookie = stripslashes($cisess_cookie);
    $cisess_cookie = unserialize($cisess_cookie);
    $cisess_session_id = $cisess_cookie['session_id'];

/*$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'toor';
$dbnya = 'siubie';
*/
$dbhost = 'localhost';
$dbuser = 'ubielabs_root';
$dbpass = 'th3conqueror';
$dbnya = 'ubielabs_blog';
/*$db['default']['hostname'] = "localhost";
$db['default']['username'] = "ubielabs_root";
$db['default']['password'] = "th3conqueror";
$db['default']['database'] = "ubielabs_blog";*/


$cisess_connect = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$cisess_connect) {
 die("ga bisa conect");
}
$cisess_query = "SELECT user_data FROM ci_sessions WHERE session_id = '$cisess_session_id' LIMIT 1";

mysql_select_db($dbnya, $cisess_connect);
$cisess_result = mysql_query($cisess_query, $cisess_connect);
if (!$cisess_result) {
 die("Invalid Query");
}
$cisess_row = mysql_fetch_assoc($cisess_result);
$cisess_data = unserialize($cisess_row['user_data']);
print_r($cisess_data);
if($cisess_data['logged_in']== '1'){
	return true;
    }else {
      return false;
    }


?>