<?php
session_start();
include("../php_crud/my_class.php");
$obj=new my_class();
if(isset($_SESSION['LOGIN_USER']))
{
	//$branches   = $_SESSION['PERMIT_BRANCH']; 
	if(isset($_POST["branch_id"]))
	{
		
		$institute_id = trim($_POST["institute_id"]);
		$institute_name = trim($_POST["institute_name"]);
		
		$branch_id = trim($_POST["branch_id"]);
		$branch_name = trim($_POST['branch_name']);
		//$if_permit_branch = substr_count($branches,$branch_id);
		if( $branch_id != "" )//&& $if_permit_branch > 0	
		{
			$_SESSION["LOGIN_INSTITUTE_ID"] = $institute_id;
			$_SESSION["LOGIN_INSTITUTE_NAME"] = $institute_name;
			$ins_obj = $obj->View_Institute_details_By_ID($institute_id);
			
			$ins_logo = $ins_obj->_logo_location;
			
			if($ins_logo && file_exists($ins_logo)){
				 $_SESSION["LOGIN_INSTITUTE_LOGO"] = $ins_logo;
				}
			
			$_SESSION["LOGIN_BRANCH"] = $branch_id;
			$_SESSION["LOGIN_BRANCH_NAME"] = $branch_name;
			
			echo 1;
		}	
	}else{
		echo 0;
	}
}
else
	echo '-1';	
?>