<?php
if(isset($_POST['action'])){
	$user=$_POST['user'];
	
	if(trim($user)==''){
		   $res['status']='error';
			$res['error']='unknown user';
			print_r(json_encode($res)) ;
			exit;
	}
	
	//getting boards for this user 
	require_once 'core.php';
	
	$boards=$pinterest->boards_get($user);
	 
		$userboards=array($boards[1],$boards[2]);
		//update boards
		update_option($user.'_boards',$userboards);
	
	   $res['status']='success';
		$res['msg']='success';
		$res['ids']=$boards[2];
		$res['titles']=$boards[1];
		print_r(json_encode($res)) ;
		exit;
	
}else{
	   $res['status']='error';
		$res['error']='unknown request';
		print_r(json_encode($res)) ;
		exit;
}