<?
	
	include("../../classes/manager.class.php");
	
	extract($_REQUEST);
	

	$user_name= array_key_exists("uname",$_REQUEST)?$_REQUEST["uname"]:0;
	$user_pwd= array_key_exists("pwd",$_REQUEST)?$_REQUEST["pwd"]:0;
	$old_pwd= array_key_exists("old_pwd",$_REQUEST)?$_REQUEST["old_pwd"]:0;
	$new_pwd= array_key_exists("new_pwd",$_REQUEST)?$_REQUEST["new_pwd"]:0;
	$action = array_key_exists("action",$_REQUEST)?$_REQUEST["action"]:0;
	
	//print($user_pwd); exit;
	$arr=array('%','$','/','\\','*','+','"','#','(',')','^','~','`','&', ',',':',';','?'
				,'<','>','!','{','}','[',']');
				
 	$user_name=str_replace($arr,'',$user_name);
	$user_pwd=str_replace($arr,'',$user_pwd);
	$old_pwd=str_replace($arr,'',$old_pwd);
	$new_pwd=str_replace($arr,'',$new_pwd);

	$mobj=new Manager();
	
	
		$obj_login=new login();

	//switch
	
	switch($action) {
		case 1:
		
			if($obj_login->is_login_profile($user_name,$user_pwd)) {
			
				//header("Location: ../index.php?action=22");
				//exit;
				
			}else{
			
				header("Location: ../index.php?action=25");
				exit;
				
			}

			if($obj_login->is_login($user_name,$user_pwd)) {
			
				//if($_SESSION['sess_type']==__ADMIN__){
					//exit;
					header("Location: ../dboardorderslist.php");
					exit;
				//}	
				
			}else{
			
				header("Location: ../index.php?action=22");
				exit;
				
			}
			
		case 2:
		
				$indexpagepath="Location: ../index.php";
				$obj_login->Logout($indexpagepath);
				exit;
			
		case 3:
			//print($user_name); exit;
			if($obj_login->ChangePassword($old_pwd,$new_pwd)){
			
				header("Location: ../dboardorderslist.php?action=11");
				exit;
				
			}else{
			
				header("Location:  ../change_pwd.php?action=10");
				exit;
			
			}
			
	exit;
		
	}
?>