<?php
	require("__include-common.php");
	require("../account/__logincheck.php");
	if ($_GET['ac'] <> $_SESSION['login_id']) {
		exit;
	}
	$updateD = date("Y/m/d H:i:s");
	$con = my_mysql_connect(_DB_SCHEMA);
	$sql = "select id_mycheck from m_mycheck";
	$sql .= " where id_account = " . $_GET['ac'] . " and id_study = " . $_GET['qz'];
	$rs = my_mysql_query($sql);
	if ($rs) {
		$row = mysql_num_rows($rs);
		if ($row <> 0) {
			$sql = "update m_mycheck";
			$sql .= " set c_check = " . $_GET['ck'];
			$sql .= ", c_updatetime = '" . $updateD . "'";
			$sql .= " where id_account = " . $_GET['ac'] . " and id_study = " . $_GET['qz'];
		} else {
			$sql = "insert into m_mycheck (";
			$sql .= "id_account, id_study, c_check";
			$sql .= ", c_updatetime, c_registtime)";
			$sql .= " values (";
			$sql .= "'" . $_GET['ac'] . "'";
			$sql .= ", '" . $_GET['qz'] . "'";
			$sql .= ", '" . $_GET['ck'] . "'";
			$sql .= ", '" . $updateD . "'";
			$sql .= ", '" . $updateD . "'";
			$sql .= ")";
		}
	}
	mysql_query($sql);
	$con = mysql_close($con);
?>
