<?php
	require '../conf/config.php';
	require 'lockfile.php';

	// Ajax以外からのアクセスを遮断
	$request = isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) : '';
	if($request !== 'xmlhttprequest') exit;

	if(empty($tempdir)) { $tempdir = TMPDIR; }
	if(!file_exists($tempdir)) {
		if(mkdir($tempdir, 0755)) { chmod($tempdir, 0755); };
	}

	header("Content-Type: application/json; charset=UTF-8");
        session_start();
	$sid = session_id();
	$return_array = getJobCount($tempdir, $sid);
/*
        $sid = session_id();
        $dir = __DIR__;
        $snum = exec("ls $dir/../tmp | wc -l" );
        $sflg = exec("ls $dir/../tmp | grep $sid");
        $return_array = array('sid' => $sid, 'snum' => $snum, 'sflg' => $sflg);
*/
        echo json_encode($return_array);
        exit;
?>
