<?php 
include_once 'db_functions.php'; 
$db = new DB_Functions(); 
$json = $_POST["activityJSON"];

if (get_magic_quotes_gpc()){ 
	$json = stripslashes($json); 
}
//Decode JSON into an Array 
$data = json_decode($json); 

//Util arrays to create response JSON 
$response=array();

for($i=0; $i<count($data) ; $i++) {
	//Send info. from app ///
	$activity_name = $data[$i]->activityName;
	$activity_desc = $data[$i]->activityDesc;
	$file_name = $data[$i]->fileName;
	$attach_file = $data[$i]->attachFile;
	$create_by = $data[$i]->createBy;
	
	//Store Data into MySQL DB 
	$res = $db-> ActivityAdd($activity_name,$activity_desc,$file_name,$attach_file,$create_by);
}
if($res==1){ 
	$response[] = array('status'=>'1','response'=>'Applied Successfully.');
}else{
	$response[] = array('status'=>'0','response'=>'Some Error Occurred.');
}

echo json_encode($response); 
?>