<?
session_start();
include("../config/connect.inc.php");
connect_db();
//session_destroy();
$id_emp=$_REQUEST["check_list"];
$from=$_REQUEST[from];//echo"$from";
$to=$_REQUEST[to];//echo"$to";
session_register("from");
session_register("to");
session_register("sess_id");
session_register("sess_name");
session_register("sess_div");
session_register("sess_sec");
if (count ($sess_id)=="0") {
$check=1;
}
else if (!in_array($id_emp,$sess_id)) {
$check=1;
}
if ($check==1) {
for($i=0;$i<sizeof($id_emp);$i++){
$sql="select * from temployee,tsection,tdepartment,tposition
where temployee.IDS=tsection.IDS
and temployee.IDD=tdepartment.IDD
and temployee.IDP=tposition.IDP
and ID='$id_emp[$i]'";
$result=mysql_query($sql) or die (mysql_error());
$rs=mysql_fetch_array($result);
$sess_id[]=$rs[ID];
$sess_name[]=$rs[NAME];
$sess_div[]=$rs[DIVISION];
$sess_sec[]=$rs[SECTION];
$sql2="select sum(Time_H) from tovermain,toversub
where tovermain.OverId=toversub.OverId
and toversub.ID='$rs[ID]' and (DateOT BETWEEN '$from' and '$to')";
$result2=mysql_query($sql2) or die (mysql_error());
$rs2=mysql_fetch_array($result2);
$sess_h[]=$rs2["sum(Time_H)"];
}
}
//session_destroy();
header("location:employee_add2.php");
disconnect_db();
?>