<?php
include ("../../include/session.php");
$empId = mysql_real_escape_string($_GET['empId']);
if(!$session->isAdmin()){
	header("Location: ../searchAndDisplayE.php?empId=$empId&type=discipline");
} else {
	include("../../include/db.php");
	$id = mysql_real_escape_string($_GET['id']);
	$q = "SELECT permission FROM nam_timekeeping WHERE timeId = '$id'";
	$r = execsql($q);
//	echo $q;
	$permission = mysql_result($r, 0, "permission");
	if($permission == 1){
		$q1 = "UPDATE nam_timekeeping SET permission = 0 WHERE timeId = '$id'";
		execsql($q1);
	}else{
		$q1 = "UPDATE nam_timekeeping SET permission = 1 WHERE timeId = '$id'";
		execsql($q1);
	}
	header("Location: ../searchAndDisplayE.php?empId=$empId&type=discipline");
}