<?php
include("../db.php");
header("Access-Control-Allow-Origin: * ");

	$idno = $_REQUEST['user_id'];
	$is_login = $_REQUEST['is_mob_login'];
	$toekn = $_REQUEST['mob_identifier'];
	$device_name = $_REQUEST['device_name'];
	$user_type = $_REQUEST['user_type'];
	
	$status = 0;
	$msg = "error occured";
	
	if($idno != '' && $is_login != ''){
	    
	            $aryData=array("is_app_login"=>$is_login, "sdl_token"=>$toekn , "device_name"=>$device_name);
	            
	    if($user_type == 'student'){
	        
	            $flgUp=$db->updateAry("student",$aryData,"where idno='$idno'");
	            
	    }else if($user_type == 'teacher'){
	            $flgUp=$db->updateAry("staff",$aryData,"where idno='$idno'");
	            
	    }else if($user_type == 'admin'){
	            $flgUp=$db->updateAry("admin",$aryData,"where id='$idno'");
	            
	    }
	    
	    
	    
	    
	    
	    if($flgUp){
	   
	    $status = 1;
	    $msg = "Success";
	    }
	    
	   
	}else{
	    $msg = "id required";
	}
	

echo json_encode(array('status' => $status, 'msg'=>$msg));