Location: PHPKode > projects > Simple E-document > simple_e_document_v_1_3/admin.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>simple e-document</title>
<style type="text/css">
<!--
.style7 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; }
.style8 {color: #FFFFFF}
-->
</style>
</head>
<body class="style7">
<p>
  <?php



if (($_COOKIE['access'] == "2") || ($_COOKIE['access'] == "3")) {

include "header.php";
include("settings.php");
$dbc = mysql_connect($databasehost, $databaseuname, $databasepass, $databasename);
$dbcs = mysql_select_db($databasename,$dbc);


if(!isset($_POST['op'])) $_POST['op']='';
if(!isset($_POST['username'])) $_POST['username']='';
if(!isset($_POST['password'])) $_POST['password']='';

if(!isset($_POST['is_admin'])) $_POST['is_admin']='';
if(!isset($_POST['is_s_admin'])) $_POST['is_s_admin']='';

if(!isset($_POST['new_password'])) $_POST['new_password']='';

if(!isset($_POST['id'])) $_POST['id']='';
if(!isset($_POST['idc'])) $_POST['idc']='';
if(!isset($_POST['username_s'])) $_POST['username_s']='';

if(!isset($_POST['IN_Document_U_No'])) $_POST['IN_Document_U_No']='';
if(!isset($_POST['IN_Document_Type'])) $_POST['IN_Document_Type']='';
if(!isset($_POST['IN_Document_From'])) $_POST['IN_Document_From']='';
if(!isset($_POST['IN_Document_From2'])) $_POST['IN_Document_From2']='';
if(!isset($_POST['IN_Document_Subject'])) $_POST['IN_Document_Subject']='';
if(!isset($_POST['IN_Document_To1'])) $_POST['IN_Document_To1']='';
if(!isset($_POST['IN_Document_To2'])) $_POST['IN_Document_To2']='';
if(!isset($_POST['IN_Document_To3'])) $_POST['IN_Document_To3']='';
if(!isset($_POST['IN_Document_To4'])) $_POST['IN_Document_To4']='';
if(!isset($_POST['IN_Document_To5'])) $_POST['IN_Document_To5']='';
if(!isset($_POST['IN_Document_Received_Day'])) $_POST['IN_Document_Received_Day']='';
if(!isset($_POST['IN_Document_Received_Month'])) $_POST['IN_Document_Received_Month']='';
if(!isset($_POST['IN_Document_Received_Year'])) $_POST['IN_Document_Received_Year']='';
if(!isset($_POST['IN_Document_Received_Hour'])) $_POST['IN_Document_Received_Hour']='';
if(!isset($_POST['IN_Document_Received_Minute'])) $_POST['IN_Document_Received_Minute']='';
if(!isset($_POST['IN_Document_Sent_Day'])) $_POST['IN_Document_Sent_Day']='';
if(!isset($_POST['IN_Document_Sent_Month'])) $_POST['IN_Document_Sent_Month']='';
if(!isset($_POST['IN_Document_Sent_Year'])) $_POST['IN_Document_Sent_Year']='';
if(!isset($_POST['IN_Document_Sent_Hour'])) $_POST['IN_Document_Sent_Hour']='';
if(!isset($_POST['IN_Document_Sent_Minute'])) $_POST['IN_Document_Sent_Minute']='';
if(!isset($_POST['IN_Document_Issued_Day'])) $_POST['IN_Document_Issued_Day']='';
if(!isset($_POST['IN_Document_Issued_Month'])) $_POST['IN_Document_Issued_Month']='';
if(!isset($_POST['IN_Document_Issued_Year'])) $_POST['IN_Document_Issued_Year']='';
if(!isset($_POST['IN_Document_Issued_Hour'])) $_POST['IN_Document_Issued_Hour']='';
if(!isset($_POST['IN_Document_Issued_Minute'])) $_POST['IN_Document_Issued_Minute']='';
if(!isset($_POST['IN_Document_Stored_Day1'])) $_POST['IN_Document_Stored_Day1']='';
if(!isset($_POST['IN_Document_Stored_Month1'])) $_POST['IN_Document_Stored_Month1']='';
if(!isset($_POST['IN_Document_Stored_Year1'])) $_POST['IN_Document_Stored_Year1']='';
if(!isset($_POST['IN_Document_Stored_Hour1'])) $_POST['IN_Document_Stored_Hour1']='';
if(!isset($_POST['IN_Document_Stored_Minute1'])) $_POST['IN_Document_Stored_Minute1']='';
if(!isset($_POST['IN_Document_Removed_Day1'])) $_POST['IN_Document_Removed_Day1']='';
if(!isset($_POST['IN_Document_Removed_Month1'])) $_POST['IN_Document_Removed_Month1']='';
if(!isset($_POST['IN_Document_Removed_Year1'])) $_POST['IN_Document_Removed_Year1']='';
if(!isset($_POST['IN_Document_Removed_Hour1'])) $_POST['IN_Document_Removed_Hour1']='';
if(!isset($_POST['IN_Document_Removed_Minute1'])) $_POST['IN_Document_Removed_Minute1']='';
if(!isset($_POST['IN_Document_Physical_File'])) $_POST['IN_Document_Physical_File']='';
if(!isset($_POST['IN_Document_Path'])) $_POST['IN_Document_Path']='';
if(!isset($_POST['IN_Document_Details'])) $_POST['IN_Document_Details']='';
if(!isset($_POST['IN_Document_Actions_Needed'])) $_POST['IN_Document_Actions_Needed']='';
if(!isset($_POST['IN_Document_Actions_Performed'])) $_POST['IN_Document_Actions_Performed']='';
if(!isset($_POST['IN_Document_All_Actions_Completed'])) $_POST['IN_Document_All_Actions_Completed']='';
if(!isset($_POST['IN_Document_Comments'])) $_POST['IN_Document_Comments']='';
if(!isset($_POST['IN_Document_Related'])) $_POST['IN_Document_Related']='';
if(!isset($_POST['IN_Document_Removed'])) $_POST['IN_Document_Removed']='';
if(!isset($_POST['IN_Document_Removed_Reason'])) $_POST['IN_Document_Removed_Reason']='';




$NOW_TIME = time();
$op = $_POST['op'];
$username= stripslashes($_POST['username']);
$password= stripslashes($_POST['password']);
$r_password = md5($password);
$is_admin = stripslashes($_POST['is_admin']);
$is_s_admin = stripslashes($_POST['is_s_admin']);

$password_temp = stripslashes($_POST['new_password']);
$new_password_s = md5($password_temp);
$id = $_POST['id'];
$idc= $_POST['idc'];
$username_s = stripslashes($_POST['username_s']);

$IN_Document_U_No = stripslashes($_POST['IN_Document_U_No']);
$IN_Document_Type = stripslashes($_POST['IN_Document_Type']);
$IN_Document_From = stripslashes($_POST['IN_Document_From']);
$IN_Document_From2 = stripslashes($_POST['IN_Document_From2']);
$IN_Document_Subject = stripslashes($_POST['IN_Document_Subject']);
$IN_Document_To1 = stripslashes($_POST['IN_Document_To1']);
$IN_Document_To2 = stripslashes($_POST['IN_Document_To2']);
$IN_Document_To3 = stripslashes($_POST['IN_Document_To3']);
$IN_Document_To4 = stripslashes($_POST['IN_Document_To4']);
$IN_Document_To5 = stripslashes($_POST['IN_Document_To5']);
$IN_Document_Received_Day = stripslashes($_POST['IN_Document_Received_Day']);
$IN_Document_Received_Month = stripslashes($_POST['IN_Document_Received_Month']);
$IN_Document_Received_Year = stripslashes($_POST['IN_Document_Received_Year']);
$IN_Document_Received_Hour = stripslashes($_POST['IN_Document_Received_Hour']);
$IN_Document_Received_Minute = stripslashes($_POST['IN_Document_Received_Minute']);
$IN_Document_Sent_Day = stripslashes($_POST['IN_Document_Sent_Day']);
$IN_Document_Sent_Month = stripslashes($_POST['IN_Document_Sent_Month']);
$IN_Document_Sent_Year = stripslashes($_POST['IN_Document_Sent_Year']);
$IN_Document_Sent_Hour = stripslashes($_POST['IN_Document_Sent_Hour']);
$IN_Document_Sent_Minute = stripslashes($_POST['IN_Document_Sent_Minute']);
$IN_Document_Issued_Day = stripslashes($_POST['IN_Document_Issued_Day']);
$IN_Document_Issued_Month = stripslashes($_POST['IN_Document_Issued_Month']);
$IN_Document_Issued_Year = stripslashes($_POST['IN_Document_Issued_Year']);
$IN_Document_Issued_Hour = stripslashes($_POST['IN_Document_Issued_Hour']);
$IN_Document_Issued_Minute = stripslashes($_POST['IN_Document_Issued_Minute']);
$IN_Document_Stored_Date = $NOW_TIME;
$IN_Document_Removed_Date = $NOW_TIME;
$IN_Document_Stored_Day1 = stripslashes($_POST['IN_Document_Stored_Day1']);
$IN_Document_Stored_Month1 = stripslashes($_POST['IN_Document_Stored_Month1']);
$IN_Document_Stored_Year1 = stripslashes($_POST['IN_Document_Stored_Year1']);
$IN_Document_Stored_Hour1 = stripslashes($_POST['IN_Document_Stored_Hour1']);
$IN_Document_Stored_Minute1 = stripslashes($_POST['IN_Document_Stored_Minute1']);
$IN_Document_Removed_Day1 = stripslashes($_POST['IN_Document_Removed_Day1']);
$IN_Document_Removed_Month1 = stripslashes($_POST['IN_Document_Removed_Month1']);
$IN_Document_Removed_Year1 = stripslashes($_POST['IN_Document_Removed_Year1']);
$IN_Document_Removed_Hour1 = stripslashes($_POST['IN_Document_Removed_Hour1']);
$IN_Document_Removed_Minute1 = stripslashes($_POST['IN_Document_Removed_Minute1']);
$IN_Document_Physical_File = stripslashes($_POST['IN_Document_Physical_File']);
$IN_Document_Path = stripslashes($_POST['IN_Document_Path']);
$IN_Document_Details = stripslashes($_POST['IN_Document_Details']);
$IN_Document_Actions_Needed = stripslashes($_POST['IN_Document_Actions_Needed']);
$IN_Document_Actions_Performed = stripslashes($_POST['IN_Document_Actions_Performed']);
$IN_Document_All_Actions_Completed = stripslashes($_POST['IN_Document_All_Actions_Completed']);
$IN_Document_Comments = stripslashes($_POST['IN_Document_Comments']);
$IN_Document_Related = stripslashes($_POST['IN_Document_Related']);
$IN_Document_Removed = stripslashes($_POST['IN_Document_Removed']);
$IN_Document_Removed_Reason = stripslashes($_POST['IN_Document_Removed_Reason']);

echo'<form id="form" name="form" method="post" action="admin.php"><table width="100%" border="0" bgcolor="#0000FF">
  <tr>
    <th class="style8" scope="col">Select Administrative Action </th>
    <th scope="col">&nbsp;</th>
  </tr>
  <tr>
    <th scope="col"><span class="style8">
      <input name="op" type="radio" value="add_new_user" />
      Add New User | 
        <input name="op" type="radio" value="view_edit_remove_users" />
      View/Edit/Remove Users 
|
     <input name="op" type="radio" value="select_removed" /> 
View/Edit Removed Documents | 
<input name="op" type="radio" value="stats" />
View Statistics </span> <input type="submit" name="Submit" value="GO" /></th>
    
  </tr>
</table></form>';

function add_new_user(){

$is_admin="";

echo '<b><br>Add New User:</b><form id="form1" name="form1" method="post" action="admin.php">
<p align="center">Username<br />
  <input type="text" name="username" />
</p>
<p align="center">Password<br />
  <input type="password" name="password" /><br>(passwords are case sensitive)
</p>';
if ($_COOKIE['access'] == "3") {
echo '<p align="center">
 Is Admin? <input name="is_admin" type="radio" value="1" />
  </p>
 <p align="center">
 Is Super Admin? <input name="is_admin" type="radio" value="2" />
 </p>';
 }
echo'<input type="hidden" name="op" value="save_new_user"/>
    <p align="center"><input type="submit" name="Submit" value="Save" /></p>
</form>';
}

function save_new_user(){
global $username, $r_password, $NOW_TIME, $is_admin, $dbc;

if (!isset($is_admin)) $is_admin='';
if (!isset($is_s_admin)) $is_s_admin='';

if ($is_admin == "2"){
$is_s_admin = "1";
$is_admin ="";
}

$sql = "Insert into edocphp_users values('', '$username', '$r_password', '$NOW_TIME', '$is_admin', '$is_s_admin')";

if (mysql_query($sql,$dbc)){
echo '<b><font color="#0000FF">New User Added!</font></b><br><br>Select New Action from the panel above.';
} else {
$mysqlerror = mysql_error();
echo'<font color="FF0000"><b>Error</b>:</font> '.$mysqlerror.'';

echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
	}

}

function Delete_User(){
global $dbc, $is_admin, $new_password_s, $username_s, $password_temp, $id;

if ($_COOKIE[access] == "2") {
$sql= "Select * From edocphp_users Where is_admin!='1' AND is_s_admin!='1' AND id='$id'";
}

if ($_COOKIE[access] == "3") {
$sql= "Select * From edocphp_users Where id='$id'";
}

$sql_res = mysql_query($sql,$dbc);

echo'<br><b>View/Edit/Remove Users:</b><br><br>';
echo '<table width="100%"  border="2" bordercolor="#CCCCCC">
  <tr>
    <td><b><div align="center">Username</b></div></td>
    <td><b><div align="center">Date Created</b></div></td>
	<td><b><div align="center">Change User Password</b><br>(passwords are case sensitive)</div></td>
    <td><b><div align="center">Set Admin / Super Admin</b></div></td>
    <td><b><div align="center">Action</b></div></td>
    </tr>';
  
$record = mysql_fetch_array($sql_res);
$id = $record[id];
$username_s = $record[username];
$Date_Created = $record[date_created];
$Is_Admin_s = $record[is_admin];
$Is_s_Admin_s = $record[is_s_admin];

$show_date = date("d/m/y :: H:i",$Date_Created);

echo '<tr><form id="form1" name="form1" method="post" action="admin.php">
    <td><div align="center">'.$username_s.'</div></td>
    <td><div align="center">'.$show_date.'</div></td>
    <td><div align="center"><input name="new_password"  type="password" /></div></td>';
    
	if ($_COOKIE[access] == "3") {
	
	if ($Is_Admin_s == "1"){
echo '<td bgcolor="#FFFF66"><div align="center"> <p align="left">
 <input name="is_admin" type="radio" value="1" checked="checked"/> Admin 
  </p>
 <p align="left">
 <input name="is_admin" type="radio" value="2" /> Super Admin <input name="is_admin" type="radio" value="3" /> Simple User
 </p>';
 }
 
 	if ($Is_s_Admin_s == "1"){
echo '<td bgcolor="#FFCC33"><div align="center"> <p align="left">
 <input name="is_admin" type="radio" value="1" /> Admin 
  </p>
 <p align="left">
 <input name="is_admin" type="radio" value="2" checked="checked"/> Super Admin <input name="is_admin" type="radio" value="3" /> Simple User<br> (This is a Super Admin. If you remove all of them you will not be able to create new admins in the future!)
 </p>';
 }
 
  	if ($Is_s_Admin_s != "1" && $Is_Admin_s != "1"){
echo '<td><div align="center"><p align="left">
 <input name="is_admin" type="radio" value="1" /> Admin 
  </p>
 <p align="left">
 <input name="is_admin" type="radio" value="2" /> Super Admin <input name="is_admin" type="radio" value="3" checked="checked"/> Simple User
 </p>';
 }
 
 } else { 
 echo'<td><div align="center">Only Super Administrators can set or view Administrators';
 }
echo '</div></td>
    <td>
    <div align="center"><input type="hidden" name="username_s" value="'.$username_s.'"><input type="hidden" name="id" value="'.$id.'"><b>Are you sure you want to Delete this user?<b><br><br>Yes!<br><input type="submit" name="op" value="Delete_User_Final" /><br><br>No Go Back!<br><input type="submit" name="op" value="view_edit_remove_users" />
</div></td>
  </form></tr>';

		
echo '</table><br><br>';
}


function view_edit_remove_users(){
global $dbc, $is_admin, $new_password_s, $username_s, $password_temp, $id;

if ($_COOKIE['access'] == "2") {
$sql= "Select * From edocphp_users Where is_admin!='1' AND is_s_admin!='1'";
}

if ($_COOKIE['access'] == "3") {
$sql= "Select * From edocphp_users";
}

$sql_res = mysql_query($sql,$dbc);

echo'<br><b>View/Edit/Remove Users:</b><br><br>';
echo '<table width="100%"  border="2" bordercolor="#CCCCCC">
  <tr>
    <td><b><div align="center">Username</b></div></td>
    <td><b><div align="center">Date Created</b></div></td>
	<td><b><div align="center">Change User Password</b><br>(passwords are case sensitive)</div></td>
    <td><b><div align="center">Set Admin / Super Admin</b></div></td>
    <td><b><div align="center">Action</b></div></td>
    </tr>';
  
while ($record = mysql_fetch_array($sql_res)) {
$id = $record['id'];
$username_s = $record['username'];
$Date_Created = $record['date_created'];
$Is_Admin_s = $record['is_admin'];
$Is_s_Admin_s = $record['is_s_admin'];

$show_date = date("d/m/y :: H:i",$Date_Created);

echo '<tr><form id="form1" name="form1" method="post" action="admin.php">
    <td><div align="center">'.$username_s.'</div></td>
    <td><div align="center">'.$show_date.'</div></td>
    <td><div align="center"><input name="new_password"  type="password" /></div></td>';
    
	if ($_COOKIE['access'] == "3") {
	
	if ($Is_Admin_s == "1"){
echo '<td bgcolor="#FFFF66"><div align="center"> <p align="left">
 <input name="is_admin" type="radio" value="1" checked="checked"/> Admin 
  </p>
 <p align="left">
 <input name="is_admin" type="radio" value="2" /> Super Admin <input name="is_admin" type="radio" value="3" /> Simple User
 </p>';
 }
 
 	if ($Is_s_Admin_s == "1"){
echo '<td bgcolor="#FFCC33"><div align="center"> <p align="left">
 <input name="is_admin" type="radio" value="1" /> Admin 
  </p>
 <p align="left">
 <input name="is_admin" type="radio" value="2" checked="checked"/> Super Admin <input name="is_admin" type="radio" value="3" /> Simple User<br> (This is a Super Admin. If you remove all of them you will not be able to create new admins in the future!)
 </p>';
 }
 
  	if ($Is_s_Admin_s != "1" && $Is_Admin_s != "1"){
echo '<td><div align="center"><p align="left">
 <input name="is_admin" type="radio" value="1" /> Admin 
  </p>
 <p align="left">
 <input name="is_admin" type="radio" value="2" /> Super Admin <input name="is_admin" type="radio" value="3" checked="checked"/> Simple User
 </p>';
 }
 
 } else { 
 echo'<td><div align="center">Only Super Administrators can set or view Administrators';
 }
echo '</div></td>
    <td>
    <div align="center"><input type="hidden" name="username_s" value="'.$username_s.'"><input type="hidden" name="id" value="'.$id.'"><input type="submit" name="op" value="Update_User" /><input type="submit" name="op" value="Delete_User" />
</div></td>
  </form></tr>';

		}
echo '</table><br><br>';
}



function Delete_User_final(){
global $dbc, $is_admin, $new_password_s, $username_s, $password_temp, $id;




$sql = "Delete From edocphp_users Where id='$id'";

if (mysql_query($sql,$dbc)){
echo '<b><font color="0000FF"><u>'.$username_s.'</u> Deleted!</font></b><br><br>Select New Action from the panel above.';

} else {
$mysqlerror = mysql_error();
echo'<font color="FF0000"><b>Error</b>:</font> '.$mysqlerror.'';

echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
}
}

function Update_User(){
global $dbc, $is_admin, $new_password_s, $username_s, $password_temp, $id;

if ($_COOKIE['access'] == "2") {
if (empty($password_temp)){
echo'<font color="FF0000"><b>Error</b>:</font> No New Password. There is nothing to Update.<br>';
}else{
$sql = " UPDATE edocphp_users SET password ='$new_password_s' Where id='$id'";
	}
}

if ($_COOKIE['access'] == "3") {
$is_s_admin="";
if ($is_admin == "2"){
$is_s_admin = "1";
$is_admin ="";
}

if ($is_admin == "3"){
$is_s_admin = "";
$is_admin ="";
}

if (empty($password_temp)){
$sql = " UPDATE edocphp_users SET is_admin='$is_admin', is_s_admin='$is_s_admin' Where  id='$id'";
}else{
$sql = " UPDATE edocphp_users SET password ='$new_password_s', is_admin='$is_admin', is_s_admin='$is_s_admin' Where id='$id'";

}
}
 
if (mysql_query($sql,$dbc)){
echo '<b><font color="#0000FF"><u>'.$username_s.'</u> Upadated!</font></b><br><br>Select New Action from the panel above.';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
} else {
$mysqlerror = mysql_error();
echo'<font color="FF0000"><b>Error</b>:</font> '.$mysqlerror.'';

echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
}
}

function stats(){
global $dbc;

echo '<br><b>Statistics:</b>';
$sql= "Select * From edocphp_main_in Where Document_Removed!='YES'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);

echo '<br><br>We have '.$no_of_rows.' Incoming Documents Stored.<br><br>';

$sql= "Select * From edocphp_main_in Where Document_Removed='YES'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);

echo 'We have '.$no_of_rows.' Incoming Documents Removed.<br><br>';

$sql= "Select * From edocphp_main_out Where Document_Removed!='YES'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);

echo 'We have '.$no_of_rows.' Outgoing Documents Stored.<br><br>';

$sql= "Select * From edocphp_main_out Where Document_Removed='YES'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);

echo 'We have '.$no_of_rows.' Outgoing Documents Removed.<br><br>';

$sql= "Select * From edocphp_users Where is_admin!='1' AND is_s_admin!='1'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);

echo 'We have '.$no_of_rows.' Users.<br><br>';

$sql= "Select * From edocphp_users Where is_admin='1'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);

echo 'We have '.$no_of_rows.' Administrators.<br><br>';

$sql= "Select * From edocphp_users Where is_s_admin='1'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);

echo 'We have '.$no_of_rows.' Super Administrators.<br><br>';
}


function view_edit_removed(){
global $dbc;

echo '<br><b>View/Edit Incoming Removed Documents:</b><br>';
$sql = "SELECT * FROM edocphp_main_in WHERE Document_Removed='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

$no_of_records = mysql_num_rows($sql_res);
 
echo '<br>Records Found:'.$no_of_records.'<br><br>';
echo "<center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br><br>";

  
while ($record = mysql_fetch_array($sql_res)) {
$idc=$record['id'];
$IN_Document_U_No = $record['Document_U_No'];
$IN_Document_Type = $record['Document_Type'];
$IN_Document_From = $record['Document_From'];
$IN_Document_From2 = $record['Document_From2'];
$IN_Document_Subject = $record['Document_Subject'];
$IN_Document_To1 = $record['Document_To1'];
$IN_Document_To2 = $record['Document_To2'];
$IN_Document_To3 = $record['Document_To3'];
$IN_Document_To4 = $record['Document_To4'];
$IN_Document_To5 = $record['Document_To5'];
$IN_Document_Received_Date = $record['Document_Received_Date'];
$IN_Document_Issued_Date = $record['Document_Issued_Date'];
$IN_Document_Stored_Day1 = date("d",$record['Document_Stored_Date']);
$IN_Document_Stored_Month1 = date("m",$record['Document_Stored_Date']);
$IN_Document_Stored_Year1 = date("y",$record['Document_Stored_Date']);
$IN_Document_Stored_Hour1 = date("H",$record['Document_Stored_Date']);
$IN_Document_Stored_Minute1 = date("i",$record['Document_Stored_Date']);
$IN_Document_Physical_File = $record['Document_Physical_File'];
$IN_Document_Details = $record['Document_Details'];
$IN_Document_Actions_Needed = $record['Document_Actions_Needed'];
$IN_Document_Actions_Performed = $record['Document_Actions_Performed'];
$IN_Document_All_Actions_Completed = $record['Document_All_Actions_Completed'];
$IN_Document_Path = $record['Document_Path'];
$IN_Document_Comments = $record['Document_Comments'];
$IN_Document_Related = $record['Document_Related'];
$IN_Document_Removed = $record['Document_Removed'];
$IN_Document_Removed_Reason = $record['Document_Removed_Reason'];
$IN_Document_Removed_Date = $record['Document_Removed_Date'];

if (!empty($IN_Document_Received_Date)){
$IN_Document_Received_Month = date("m",$IN_Document_Received_Date);
$IN_Document_Received_Day = date("d",$IN_Document_Received_Date);
$IN_Document_Received_Year = date("y",$IN_Document_Received_Date);
$IN_Document_Received_Hour = date("H",$IN_Document_Received_Date);
$IN_Document_Received_Minute = date("i",$IN_Document_Received_Date);
$IN_Document_Received_Full = date("d/m/y",$IN_Document_Received_Date);
}

if (!empty($IN_Document_Issued_Date)){
$IN_Document_Issued_Month = date("m",$IN_Document_Issued_Date);
$IN_Document_Issued_Day = date("d",$IN_Document_Issued_Date);
$IN_Document_Issued_Year = date("y",$IN_Document_Issued_Date);
$IN_Document_Issued_Hour = date("H",$IN_Document_Issued_Date);
$IN_Document_Issued_Minute = date("i",$IN_Document_Issued_Date);
}

if (!empty($IN_Document_Removed_Date)){
$IN_Document_Removed_Month = date("m",$IN_Document_Removed_Date);
$IN_Document_Removed_Day = date("d",$IN_Document_Removed_Date);
$IN_Document_Removed_Year = date("y",$IN_Document_Removed_Date);
$IN_Document_Removed_Hour = date("H",$IN_Document_Removed_Date);
$IN_Document_Removed_Minute = date("i",$IN_Document_Removed_Date);
}

echo '<table width="100%" border="0" bgcolor="#FFFF66">
  <tr>
    <th scope="col">&nbsp;</th>
  </tr>
</table><form id="form" name="form" method="post" action="admin.php">
  <table width="100%" border="0">
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Document Unique No</span></td>
      <td valign="top">';
	  if (($_COOKIE['access'] == "2") || ($_COOKIE['access'] == "3")){
	  echo'<input name="IN_Document_U_No" value="'.$IN_Document_U_No.'" type="text" id="IN_Document_U_No" />';
	  }else{
	  echo'<b>'.$IN_Document_U_No.'</b>';
	  }
	  echo'<br>(to prevent mistakes, only admins can edit this field, changing this without reason may cause problems)</td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Type</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_Type"  size="1" id="IN_Document_Type">';
          if ($IN_Document_Type=="LETTER"){
		  echo'<option value="LETTER" selected="selected">Letter</option>
          <option value="FAX">FAX</option>
          <option value="EMAIL">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		     if ($IN_Document_Type=="FAX"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" selected="selected">FAX</option>
          <option value="EMAIL">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		     if ($IN_Document_Type=="EMAIL"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" >FAX</option>
          <option value="EMAIL" selected="selected">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		       if ($IN_Document_Type=="OTHER"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" >FAX</option>
          <option value="EMAIL" >EMail</option>
          <option value="OTHER" selected="selected">Other</option>';
		  }
        echo'</select>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">From</span></td>
      <td valign="top"><input name="id" value="'.$id.'" type="hidden" /><input name="IN_Document_From" value="'.$IN_Document_From.'" type="text" id="IN_Document_From" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">From (2)</span></td>
      <td valign="top"><input name="IN_Document_From2" value="'.$IN_Document_From2.'" type="text" id="IN_Document_From2" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Subject</span></td>
      <td valign="top"><input name="IN_Document_Subject" value="'.$IN_Document_Subject.'" type="text" id="IN_Document_Subject" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">To (Recipient)1</span></td>
      <td valign="top"><input name="IN_Document_To1" value="'.$IN_Document_To1.'" type="text" id="IN_Document_To1" /></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">To (Recipient) (2)</span></td>
      <td valign="top"><input name="IN_Document_To2" value="'.$IN_Document_To2.'" type="text" id="IN_Document_To2" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top" nowrap="nowrap"><span class="style7">To(Recipient) 3</span></td>
      <td valign="top"><input name="IN_Document_To3" value="'.$IN_Document_To3.'" type="text" id="IN_Document_To3" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">
             To(Recipient) 4</span></td>
      <td valign="top"><input name="IN_Document_To4" value="'.$IN_Document_To4.'" type="text" id="IN_Document_To4" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7" >To (Recipient) 5</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_To5" cols="40" rows="5" id="IN_Document_To5">'.$IN_Document_To5.'</textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Issued Date</span></td>
      <td valign="top"><input name="IN_Document_Issued_Day" value="'.$IN_Document_Issued_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Day" />/<input name="IN_Document_Issued_Month" value="'.$IN_Document_Issued_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Month" />/<input 	   		name="IN_Document_Issued_Year" value="'.$IN_Document_Issued_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Issued_Year" /> :: <input 		  		name="IN_Document_Issued_Hour" value="'.$IN_Document_Issued_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Hour" />:<input 	  name="IN_Document_Issued_Minute" value="'.$IN_Document_Issued_Minute.'" type="text"  size="2" maxlength="2" id="IN_Document_Issued_Minute" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Received Date
		</span></td>
      <td valign="top"><input name="IN_Document_Received_Day" value="'.$IN_Document_Received_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Day" />/<input name="IN_Document_Received_Month" value="'.$IN_Document_Received_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Month" />/<input 	   		name="IN_Document_Received_Year" value="'.$IN_Document_Received_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Received_Year" /> :: <input 		  		name="IN_Document_Received_Hour" value="'.$IN_Document_Received_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Hour" />:<input 	  name="IN_Document_Received_Minute" value="'.$IN_Document_Received_Minute.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Minute" /></td>
    </tr>
    <tr  bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Stored Date</span></td>
      <td valign="top"><input name="IN_Document_Stored_Day1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Day1.'"/>/<input name="IN_Document_Stored_Month1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Month1.'"/>/<input name="IN_Document_Stored_Year1" type="text" size="4" maxlength="4" value="'.$IN_Document_Stored_Year1.'"/> :: <input name="IN_Document_Stored_Hour1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Hour1.'"/>:<input name="IN_Document_Stored_Minute1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Minute1.'"/></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Physical File</span></td>
      <td valign="top"><input name="IN_Document_Physical_File" value="'.$IN_Document_Physical_File.'" type="text" id="IN_Document_Physical_File" /></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Path</span></td>
      <td valign="top"><input name="IN_Document_Path" value="'.$IN_Document_Path.'" size="40" type="text" id="IN_Document_Path" /><br> <a href="'.$IN_Document_Path.'" target="_blank"><br><b>Open File</b></a></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">
              </span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Details"  cols="40" rows="5" id="IN_Document_Details">'.$IN_Document_Details.'</textarea>
      </span></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Actions Needed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Needed"  cols="40" rows="5" id="IN_Document_Actions_Needed">'.$IN_Document_Actions_Needed.'</textarea>
      </span></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Actions Performed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Performed" cols="40" rows="5" id="IN_Document_Actions_Performed">'.$IN_Document_Actions_Performed.'</textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7"> All Actions Completed</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_All_Actions_Completed" size="1" id="IN_Document_All_Actions_Completed">';
		if ($IN_Document_All_Actions_Completed=="NO"){
          echo'<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>
          <option value="NOACTION" >NO ACTION REQUIRED</option>';
		  }
		  if ($IN_Document_All_Actions_Completed=="YES"){
          echo'<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>
          <option value="NOACTION" >NO ACTION REQUIRED</option>';
		  }
		  if ($IN_Document_All_Actions_Completed=="NOACTION"){
          echo'<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>
          <option value="NOACTION" selected="selected">NO ACTION REQUIRED</option>';
		  }
          echo '</select>
      </span> </td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Comments</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Comments" cols="40" rows="5" id="IN_Document_Comments">'.$IN_Document_Comments.'</textarea>
      </span></td>
    </tr>
	<tr>
	<td valign="top" bgcolor="#FFFFCC"><span class="style7">Related Documents</span></td>
      <td valign="top" bgcolor="#FFFFCC"><span class="style7">
        <textarea name="IN_Document_Related" cols="40" rows="5" id="IN_Document_Related">'.$IN_Document_Related.'</textarea>
      </span></td><td valign="top" bgcolor="#FFFFCC"><span class="style7"></td><td valign="top" bgcolor="#FFFFCC"><span class="style7"></td><td valign="top" bgcolor="#FFFFCC"><span class="style7"></td>
    </tr>
	<tr>
	<td colspan="5">
	<b><br>This Document has been Removed.<br></b>
	</td>
	</tr>
    <tr bgcolor="#FFFF66">
	<td valign="top"><span class="style7">Removed <br> (Set this to <i>No</i> if you want this document to be Restored.)
              </span></td>
      <td valign="top"><select name="IN_Document_Removed" size="1" >';
	  if ($IN_Document_Removed=="NO"){
          echo '<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>';
		  }
		  if (empty($IN_Document_Removed)){
          echo '<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>';
		  }
		  if ($IN_Document_Removed=="YES"){
          echo '<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>';
		  }
           echo'</select><br>(If you set this to YES and save the form, this file will not appear again in any future search. You will not be able to bring back this document. This can be done only from Administration Page. The record will not be deleted (for no reason should anyone delete a record, this may cause also software malfunction), but it will marked as Removed and will not appear anywhere. You can Restore this record by setting this field to NO.)
		  </td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Removed Reason</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Removed_Reason" cols="40" rows="5" id="IN_Document_Removed_Reason">'.$IN_Document_Removed_Reason.'</textarea>
      </span></td>
    </tr>
    <tr bgcolor="#FFFF66">
      <td valign="top"><span class="style7">Removed Date</span></td>
      <td valign="top"><div align="center"><input name="IN_Document_Removed_Day1" value="'.$IN_Document_Removed_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Removed_Day" />/<input name="IN_Document_Removed_Month1" value="'.$IN_Document_Removed_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Removed_Month" />/<input 	   		name="IN_Document_Removed_Year1" value="'.$IN_Document_Removed_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Removed_Year" /> :: <input 		  		name="IN_Document_Removed_Hour1" value="'.$IN_Document_Removed_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Removed_Hour" />:<input 	  name="IN_Document_Removed_Minute1" value="'.$IN_Document_Removed_Minute.'" type="text"  size="2" maxlength="2" id="IN_Document_Removed_Minute" /></div></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7"></span></td>
      <td valign="top"><span class="style7">
   
      </span></td>
    </tr>
  </table>
  <input type="hidden" name="idc" value="'.$idc.'">
  <input type="hidden" name="op" value="update_in">
  <br><div align="center"><input type="submit" value="If you have Changed or Restored this Record Click Here to Save your Changes"></div>
</form>';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br>";	
		}

	}
	

function update_in(){
global $dbc;

global $idc, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1, $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute,$IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Day1, $IN_Document_Stored_Month1, $IN_Document_Stored_Year1, $IN_Document_Stored_Hour1, $IN_Document_Stored_Minute1, $IN_Document_Removed_Day1, $IN_Document_Removed_Month1, $IN_Document_Removed_Year1, $IN_Document_Removed_Hour1, $IN_Document_Removed_Minute1, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed, $IN_Document_Removed_Reason, $IN_Document_Removed_Date;

//check for document Issued date
If (!empty($IN_Document_Issued_Minute) && !empty($IN_Document_Issued_Hour) &&  !empty($IN_Document_Issued_Month) &&  !empty($IN_Document_Issued_Day) &&  !empty($IN_Document_Issued_Year)){
$IN_Document_Issued_Date = mktime ($IN_Document_Issued_Hour, $IN_Document_Issued_Minute, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
}else{
if (empty($IN_Document_Issued_Hour) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Hour.<br>"; 
}else{
if ( empty($IN_Document_Issued_Minute) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Minute.<br>"; 
}else{
if (empty($IN_Document_Issued_Month) || empty($IN_Document_Issued_Day) || empty($IN_Document_Issued_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Issued Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

//check for document received date
If (!empty($IN_Document_Received_Minute) && !empty($IN_Document_Received_Hour) &&  !empty($IN_Document_Received_Month) &&  !empty($IN_Document_Received_Day) &&  !empty($IN_Document_Received_Year)){
$IN_Document_Received_Date = mktime ($IN_Document_Received_Hour, $IN_Document_Received_Minute, 00, $IN_Document_Received_Month, $IN_Document_Received_Day,$IN_Document_Received_Year);
}else{
if (empty($IN_Document_Received_Hour) AND ( !empty($IN_Document_Received_Month) && !empty($IN_Document_Received_Day) && !empty($IN_Document_Received_Year))){
$IN_Document_Received_Date = mktime (00, 00, 00, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year);
echo " Received Date Will be Stored without hour and minute details becouse you did not set Received Hour.<br>"; 
}else{
if ( empty($IN_Document_Received_Minute) AND ( !empty($IN_Document_Received_Month) && !empty($IN_Document_Received_Day) && !empty($IN_Document_Received_Year))){
$IN_Document_Received_Date = mktime (00, 00, 00, $IN_Document_Received_Month, $IN_Document_Received_Day,$IN_Document_Received_Year);
echo " Received Date Will be Stored without hour and minute details becouse you did not set Received Minute.<br>"; 
}else{
if (empty($IN_Document_Received_Month) || empty($IN_Document_Received_Day) || empty($IN_Document_Received_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Received Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}


//check for document stored date
If (!empty($IN_Document_Stored_Minute1) && !empty($IN_Document_Stored_Hour1) &&  !empty($IN_Document_Stored_Month1) &&  !empty($IN_Document_Stored_Day1) &&  !empty($IN_Document_Stored_Year1)){
$IN_Document_Stored_Date1 = mktime ($IN_Document_Stored_Hour1, $IN_Document_Stored_Minute1, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1,$IN_Document_Stored_Year1);
}else{
if (empty($IN_Document_Stored_Hour1) AND ( !empty($IN_Document_Stored_Month1) && !empty($IN_Document_Stored_Day1) && !empty($IN_Document_Stored_Year))){
$IN_Document_Stored_Date1 = mktime (00, 00, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1, $IN_Document_Stored_Year1);
echo " Stored Date Will be Stored without hour and minute details becouse you did not set Stored Hour.<br>"; 
}else{
if ( empty($IN_Document_Stored_Minute1) AND ( !empty($IN_Document_Stored_Month1) && !empty($IN_Document_Stored_Day1) && !empty($IN_Document_Stored_Year1))){
$IN_Document_Stored_Date1 = mktime (00, 00, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1,$IN_Document_Stored_Year1);
echo " Stored Date Will be Stored without hour and minute details becouse you did not set Stored Minute.<br>"; 
}else{
if (empty($IN_Document_Stored_Month1) || empty($IN_Document_Stored_Day1) || empty($IN_Document_Stored_Year1)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Stored Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

//check for document removed date
If (!empty($IN_Document_Removed_Minute1) && !empty($IN_Document_Removed_Hour1) &&  !empty($IN_Document_Removed_Month1) &&  !empty($IN_Document_Removed_Day1) &&  !empty($IN_Document_Removed_Year1)){
$IN_Document_Removed_Date1 = mktime ($IN_Document_Removed_Hour1, $IN_Document_Removed_Minute1, 00, $IN_Document_Removed_Month1, $IN_Document_Removed_Day1,$IN_Document_Removed_Year1);
}else{
if (empty($IN_Document_Removed_Hour1) AND ( !empty($IN_Document_Removed_Month1) && !empty($IN_Document_Removed_Day1) && !empty($IN_Document_Removed_Year))){
$IN_Document_Removed_Date1 = mktime (00, 00, 00, $IN_Document_Removed_Month1, $IN_Document_Removed_Day1, $IN_Document_Removed_Year1);
echo " Removed Date Will be Removed without hour and minute details becouse you did not set Removed Hour.<br>"; 
}else{
if ( empty($IN_Document_Removed_Minute1) AND ( !empty($IN_Document_Removed_Month1) && !empty($IN_Document_Removed_Day1) && !empty($IN_Document_Removed_Year1))){
$IN_Document_Removed_Date1 = mktime (00, 00, 00, $IN_Document_Removed_Month1, $IN_Document_Removed_Day1,$IN_Document_Removed_Year1);
echo " Removed Date Will be Removed without hour and minute details becouse you did not set Removed Minute.<br>"; 
}else{
if (empty($IN_Document_Removed_Month1) || empty($IN_Document_Removed_Day1) || empty($IN_Document_Removed_Year1)){
$IN_Document_Removed_Date1="";

			}
		}
	}
}

$sql = " UPDATE edocphp_main_in SET Document_U_No='$IN_Document_U_No', Document_Type='$IN_Document_Type', Document_From='$IN_Document_From', Document_From2='$IN_Document_From2', Document_Subject='$IN_Document_Subject', Document_To1='$IN_Document_To1', Document_To2='$IN_Document_To2', Document_To3='$IN_Document_To3', Document_To4='$IN_Document_To4', Document_To5='$IN_Document_To5', Document_Issued_Date='$IN_Document_Issued_Date', Document_Received_Date='$IN_Document_Received_Date', Document_Stored_Date='$IN_Document_Stored_Date1', Document_Physical_File='$IN_Document_Physical_File', Document_Path='$IN_Document_Path', Document_Details='$IN_Document_Details', Document_Actions_Needed='$IN_Document_Actions_Needed', Document_Actions_Performed='$IN_Document_Actions_Performed', Document_All_Actions_Completed='$IN_Document_All_Actions_Completed', Document_Comments='$IN_Document_Comments', Document_Removed='$IN_Document_Removed', Document_Removed_Reason='$IN_Document_Removed_Reason', Document_Removed_Date='$IN_Document_Removed_Date1', Document_Related='$IN_Document_Related' WHERE id='$idc'";

if (mysql_query($sql,$dbc)){
echo '<b><font color="#0000FF">Information Stored!</font></b><br><br>Select New Action from the panel above.';
} else {
$mysqlerror = mysql_error();
echo'<font color="FF0000"><b>Error</b>:</font> '.$mysqlerror.'';

echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
}
}

function view_edit_removed_out(){
global $dbc;

echo '<br><b>View/Edit Incoming Removed Documents:</b><br>';
$sql = "SELECT * FROM edocphp_main_out WHERE Document_Removed='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

$no_of_records = mysql_num_rows($sql_res);
 
echo '<br>Records Found:'.$no_of_records.'<br><br>';
echo "<center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br><br>";

  
while ($record = mysql_fetch_array($sql_res)) {
$idc=$record[id];
$IN_Document_U_No = $record[Document_U_No];
$IN_Document_Type = $record[Document_Type];
$IN_Document_From = $record[Document_From];
$IN_Document_From2 = $record[Document_From2];
$IN_Document_Subject = $record[Document_Subject];
$IN_Document_To1 = $record[Document_To1];
$IN_Document_To2 = $record[Document_To2];
$IN_Document_To3 = $record[Document_To3];
$IN_Document_To4 = $record[Document_To4];
$IN_Document_To5 = $record[Document_To5];
$IN_Document_Sent_Date = $record[Document_Sent_Date];
$IN_Document_Issued_Date = $record[Document_Issued_Date];
$IN_Document_Stored_Day1 = date("d",$record[Document_Stored_Date]);
$IN_Document_Stored_Month1 = date("m",$record[Document_Stored_Date]);
$IN_Document_Stored_Year1 = date("y",$record[Document_Stored_Date]);
$IN_Document_Stored_Hour1 = date("H",$record[Document_Stored_Date]);
$IN_Document_Stored_Minute1 = date("i",$record[Document_Stored_Date]);
$IN_Document_Physical_File = $record[Document_Physical_File];
$IN_Document_Details = $record[Document_Details];
$IN_Document_Actions_Needed = $record[Document_Actions_Needed];
$IN_Document_Actions_Performed = $record[Document_Actions_Performed];
$IN_Document_All_Actions_Completed = $record[Document_All_Actions_Completed];
$IN_Document_Path = $record[Document_Path];
$IN_Document_Comments = $record[Document_Comments];
$IN_Document_Related = $record[Document_Related];
$IN_Document_Removed = $record[Document_Removed];
$IN_Document_Removed_Reason = $record[Document_Removed_Reason];
$IN_Document_Removed_Date = $record[Document_Removed_Date];

if (!empty($IN_Document_Sent_Date)){
$IN_Document_Sent_Month = date("m",$IN_Document_Sent_Date);
$IN_Document_Sent_Day = date("d",$IN_Document_Sent_Date);
$IN_Document_Sent_Year = date("y",$IN_Document_Sent_Date);
$IN_Document_Sent_Hour = date("H",$IN_Document_Sent_Date);
$IN_Document_Sent_Minute = date("i",$IN_Document_Sent_Date);
$IN_Document_Sent_Full = date("d/m/y",$IN_Document_Sent_Date);
}

if (!empty($IN_Document_Issued_Date)){
$IN_Document_Issued_Month = date("m",$IN_Document_Issued_Date);
$IN_Document_Issued_Day = date("d",$IN_Document_Issued_Date);
$IN_Document_Issued_Year = date("y",$IN_Document_Issued_Date);
$IN_Document_Issued_Hour = date("H",$IN_Document_Issued_Date);
$IN_Document_Issued_Minute = date("i",$IN_Document_Issued_Date);
}

if (!empty($IN_Document_Removed_Date)){
$IN_Document_Removed_Month = date("m",$IN_Document_Removed_Date);
$IN_Document_Removed_Day = date("d",$IN_Document_Removed_Date);
$IN_Document_Removed_Year = date("y",$IN_Document_Removed_Date);
$IN_Document_Removed_Hour = date("H",$IN_Document_Removed_Date);
$IN_Document_Removed_Minute = date("i",$IN_Document_Removed_Date);
}

echo '<table width="100%" border="0" bgcolor="#FFFF66">
  <tr>
    <th scope="col">&nbsp;</th>
  </tr>
</table><form id="form" name="form" method="post" action="admin.php">
  <table width="100%" border="0">
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Document Unique No</span></td>
      <td valign="top">';
	  if (($_COOKIE[access] == "2") || ($_COOKIE[access] == "3")){
	  echo'<input name="IN_Document_U_No" value="'.$IN_Document_U_No.'" type="text" id="IN_Document_U_No" />';
	  }else{
	  echo'<b>'.$IN_Document_U_No.'</b>';
	  }
	  echo'<br>(to prevent mistakes, only admins can edit this field, changing this without reason may cause problems)</td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Type</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_Type"  size="1" id="IN_Document_Type">';
          if ($IN_Document_Type=="LETTER"){
		  echo'<option value="LETTER" selected="selected">Letter</option>
          <option value="FAX">FAX</option>
          <option value="EMAIL">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		     if ($IN_Document_Type=="FAX"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" selected="selected">FAX</option>
          <option value="EMAIL">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		     if ($IN_Document_Type=="EMAIL"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" >FAX</option>
          <option value="EMAIL" selected="selected">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		       if ($IN_Document_Type=="OTHER"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" >FAX</option>
          <option value="EMAIL" >EMail</option>
          <option value="OTHER" selected="selected">Other</option>';
		  }
        echo'</select>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">From</span></td>
      <td valign="top"><input name="id" value="'.$id.'" type="hidden" /><input name="IN_Document_From" value="'.$IN_Document_From.'" type="text" id="IN_Document_From" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">From (2)</span></td>
      <td valign="top"><input name="IN_Document_From2" value="'.$IN_Document_From2.'" type="text" id="IN_Document_From2" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Subject</span></td>
      <td valign="top"><input name="IN_Document_Subject" value="'.$IN_Document_Subject.'" type="text" id="IN_Document_Subject" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">To (Recipient)1</span></td>
      <td valign="top"><input name="IN_Document_To1" value="'.$IN_Document_To1.'" type="text" id="IN_Document_To1" /></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">To (Recipient) (2)</span></td>
      <td valign="top"><input name="IN_Document_To2" value="'.$IN_Document_To2.'" type="text" id="IN_Document_To2" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top" nowrap="nowrap"><span class="style7">To(Recipient) 3</span></td>
      <td valign="top"><input name="IN_Document_To3" value="'.$IN_Document_To3.'" type="text" id="IN_Document_To3" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">
             To(Recipient) 4</span></td>
      <td valign="top"><input name="IN_Document_To4" value="'.$IN_Document_To4.'" type="text" id="IN_Document_To4" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7" >To (Recipient) 5</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_To5" cols="40" rows="5" id="IN_Document_To5">'.$IN_Document_To5.'</textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Issued Date</span></td>
      <td valign="top"><input name="IN_Document_Issued_Day" value="'.$IN_Document_Issued_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Day" />/<input name="IN_Document_Issued_Month" value="'.$IN_Document_Issued_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Month" />/<input 	   		name="IN_Document_Issued_Year" value="'.$IN_Document_Issued_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Issued_Year" /> :: <input 		  		name="IN_Document_Issued_Hour" value="'.$IN_Document_Issued_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Hour" />:<input 	  name="IN_Document_Issued_Minute" value="'.$IN_Document_Issued_Minute.'" type="text"  size="2" maxlength="2" id="IN_Document_Issued_Minute" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Sent Date
		</span></td>
      <td valign="top"><input name="IN_Document_Sent_Day" value="'.$IN_Document_Sent_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Sent_Day" />/<input name="IN_Document_Sent_Month" value="'.$IN_Document_Sent_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Sent_Month" />/<input 	   		name="IN_Document_Sent_Year" value="'.$IN_Document_Sent_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Sent_Year" /> :: <input 		  		name="IN_Document_Sent_Hour" value="'.$IN_Document_Sent_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Sent_Hour" />:<input 	  name="IN_Document_Sent_Minute" value="'.$IN_Document_Sent_Minute.'" type="text" size="2" maxlength="2" id="IN_Document_Sent_Minute" /></td>
    </tr>
    <tr  bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Stored Date</span></td>
      <td valign="top"><input name="IN_Document_Stored_Day1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Day1.'"/>/<input name="IN_Document_Stored_Month1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Month1.'"/>/<input name="IN_Document_Stored_Year1" type="text" size="4" maxlength="4" value="'.$IN_Document_Stored_Year1.'"/> :: <input name="IN_Document_Stored_Hour1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Hour1.'"/>:<input name="IN_Document_Stored_Minute1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Minute1.'"/></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Physical File</span></td>
      <td valign="top"><input name="IN_Document_Physical_File" value="'.$IN_Document_Physical_File.'" type="text" id="IN_Document_Physical_File" /></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Path</span></td>
      <td valign="top"><input name="IN_Document_Path" value="'.$IN_Document_Path.'" size="40" type="text" id="IN_Document_Path" /><br> <a href="'.$IN_Document_Path.'" target="_blank"><br><b>Open File</b></a></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">
              </span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Details"  cols="40" rows="5" id="IN_Document_Details">'.$IN_Document_Details.'</textarea>
      </span></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Actions Needed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Needed"  cols="40" rows="5" id="IN_Document_Actions_Needed">'.$IN_Document_Actions_Needed.'</textarea>
      </span></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Actions Performed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Performed" cols="40" rows="5" id="IN_Document_Actions_Performed">'.$IN_Document_Actions_Performed.'</textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7"> All Actions Completed</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_All_Actions_Completed" size="1" id="IN_Document_All_Actions_Completed">';
		if ($IN_Document_All_Actions_Completed=="NO"){
          echo'<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>
          <option value="NOACTION" >NO ACTION REQUIRED</option>';
		  }
		  if ($IN_Document_All_Actions_Completed=="YES"){
          echo'<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>
          <option value="NOACTION" >NO ACTION REQUIRED</option>';
		  }
		  if ($IN_Document_All_Actions_Completed=="NOACTION"){
          echo'<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>
          <option value="NOACTION" selected="selected">NO ACTION REQUIRED</option>';
		  }
          echo '</select>

      </span> </td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Comments</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Comments" cols="40" rows="5" id="IN_Document_Comments">'.$IN_Document_Comments.'</textarea>
      </span></td>
    </tr>
	<tr>
	<td valign="top" bgcolor="#FFFFCC"><span class="style7">Related Documents</span></td>
      <td valign="top" bgcolor="#FFFFCC"><span class="style7">
        <textarea name="IN_Document_Related" cols="40" rows="5" id="IN_Document_Related">'.$IN_Document_Related.'</textarea>
      </span></td><td valign="top" bgcolor="#FFFFCC"><span class="style7"></td><td valign="top" bgcolor="#FFFFCC"><span class="style7"></td><td valign="top" bgcolor="#FFFFCC"><span class="style7"></td>
    </tr>
	<tr>
	<td colspan="5">
	<b><br>This Document has been Removed.<br></b>
	</td>
	</tr>
    <tr bgcolor="#FFFF66">
	<td valign="top"><span class="style7">Removed <br> (Set this to <i>No</i> if you want this document to be Restored.)
              </span></td>
      <td valign="top"><select name="IN_Document_Removed" size="1" >';
	  if ($IN_Document_Removed=="NO"){
          echo '<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>';
		  }
		  if (empty($IN_Document_Removed)){
          echo '<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>';
		  }
		  if ($IN_Document_Removed=="YES"){
          echo '<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>';
		  }
           echo'</select><br>(If you set this to YES and save the form, this file will not appear again in any future search. You will not be able to bring back this document. This can be done only from Administration Page. The record will not be deleted (for no reason should anyone delete a record, this may cause also software malfunction), but it will marked as Removed and will not appear anywhere. You can Restore this record by setting this field to NO.)
		  </td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Removed Reason</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Removed_Reason" cols="40" rows="5" id="IN_Document_Removed_Reason">'.$IN_Document_Removed_Reason.'</textarea>
      </span></td>
    </tr>
    <tr bgcolor="#FFFF66">
      <td valign="top"><span class="style7">Removed Date</span></td>
      <td valign="top"><div align="center"><input name="IN_Document_Removed_Day1" value="'.$IN_Document_Removed_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Removed_Day" />/<input name="IN_Document_Removed_Month1" value="'.$IN_Document_Removed_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Removed_Month" />/<input 	   		name="IN_Document_Removed_Year1" value="'.$IN_Document_Removed_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Removed_Year" /> :: <input 		  		name="IN_Document_Removed_Hour1" value="'.$IN_Document_Removed_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Removed_Hour" />:<input 	  name="IN_Document_Removed_Minute1" value="'.$IN_Document_Removed_Minute.'" type="text"  size="2" maxlength="2" id="IN_Document_Removed_Minute" /></div></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7"></span></td>
      <td valign="top"><span class="style7">
   
      </span></td>
    </tr>
  </table>
  <input type="hidden" name="idc" value="'.$idc.'">
  <input type="hidden" name="op" value="update_in_out">
  <br><div align="center"><input type="submit" value="If you have Changed or Restored this Record Click Here to Save your Changes"></div>
</form>';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br>";	
		}

	}
	

function update_in_out(){
global $dbc;

global $idc, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1, $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Sent_Hour, $IN_Document_Sent_Minute,$IN_Document_Sent_Month, $IN_Document_Sent_Day, $IN_Document_Sent_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Day1, $IN_Document_Stored_Month1, $IN_Document_Stored_Year1, $IN_Document_Stored_Hour1, $IN_Document_Stored_Minute1, $IN_Document_Removed_Day1, $IN_Document_Removed_Month1, $IN_Document_Removed_Year1, $IN_Document_Removed_Hour1, $IN_Document_Removed_Minute1, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed, $IN_Document_Removed_Reason, $IN_Document_Removed_Date;

//check for document Issued date
If (!empty($IN_Document_Issued_Minute) && !empty($IN_Document_Issued_Hour) &&  !empty($IN_Document_Issued_Month) &&  !empty($IN_Document_Issued_Day) &&  !empty($IN_Document_Issued_Year)){
$IN_Document_Issued_Date = mktime ($IN_Document_Issued_Hour, $IN_Document_Issued_Minute, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
}else{
if (empty($IN_Document_Issued_Hour) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Hour.<br>"; 
}else{
if ( empty($IN_Document_Issued_Minute) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Minute.<br>"; 
}else{
if (empty($IN_Document_Issued_Month) || empty($IN_Document_Issued_Day) || empty($IN_Document_Issued_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Issued Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

//check for document Sent date
If (!empty($IN_Document_Sent_Minute) && !empty($IN_Document_Sent_Hour) &&  !empty($IN_Document_Sent_Month) &&  !empty($IN_Document_Sent_Day) &&  !empty($IN_Document_Sent_Year)){
$IN_Document_Sent_Date = mktime ($IN_Document_Sent_Hour, $IN_Document_Sent_Minute, 00, $IN_Document_Sent_Month, $IN_Document_Sent_Day,$IN_Document_Sent_Year);
}else{
if (empty($IN_Document_Sent_Hour) AND ( !empty($IN_Document_Sent_Month) && !empty($IN_Document_Sent_Day) && !empty($IN_Document_Sent_Year))){
$IN_Document_Sent_Date = mktime (00, 00, 00, $IN_Document_Sent_Month, $IN_Document_Sent_Day, $IN_Document_Sent_Year);
echo " Sent Date Will be Stored without hour and minute details becouse you did not set Sent Hour.<br>"; 
}else{
if ( empty($IN_Document_Sent_Minute) AND ( !empty($IN_Document_Sent_Month) && !empty($IN_Document_Sent_Day) && !empty($IN_Document_Sent_Year))){
$IN_Document_Sent_Date = mktime (00, 00, 00, $IN_Document_Sent_Month, $IN_Document_Sent_Day,$IN_Document_Sent_Year);
echo " Sent Date Will be Stored without hour and minute details becouse you did not set Sent Minute.<br>"; 
}else{
if (empty($IN_Document_Sent_Month) || empty($IN_Document_Sent_Day) || empty($IN_Document_Sent_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Sent Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}


//check for document stored date
If (!empty($IN_Document_Stored_Minute1) && !empty($IN_Document_Stored_Hour1) &&  !empty($IN_Document_Stored_Month1) &&  !empty($IN_Document_Stored_Day1) &&  !empty($IN_Document_Stored_Year1)){
$IN_Document_Stored_Date1 = mktime ($IN_Document_Stored_Hour1, $IN_Document_Stored_Minute1, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1,$IN_Document_Stored_Year1);
}else{
if (empty($IN_Document_Stored_Hour1) AND ( !empty($IN_Document_Stored_Month1) && !empty($IN_Document_Stored_Day1) && !empty($IN_Document_Stored_Year))){
$IN_Document_Stored_Date1 = mktime (00, 00, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1, $IN_Document_Stored_Year1);
echo " Stored Date Will be Stored without hour and minute details becouse you did not set Stored Hour.<br>"; 
}else{
if ( empty($IN_Document_Stored_Minute1) AND ( !empty($IN_Document_Stored_Month1) && !empty($IN_Document_Stored_Day1) && !empty($IN_Document_Stored_Year1))){
$IN_Document_Stored_Date1 = mktime (00, 00, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1,$IN_Document_Stored_Year1);
echo " Stored Date Will be Stored without hour and minute details becouse you did not set Stored Minute.<br>"; 
}else{
if (empty($IN_Document_Stored_Month1) || empty($IN_Document_Stored_Day1) || empty($IN_Document_Stored_Year1)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Stored Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

//check for document removed date
If (!empty($IN_Document_Removed_Minute1) && !empty($IN_Document_Removed_Hour1) &&  !empty($IN_Document_Removed_Month1) &&  !empty($IN_Document_Removed_Day1) &&  !empty($IN_Document_Removed_Year1)){
$IN_Document_Removed_Date1 = mktime ($IN_Document_Removed_Hour1, $IN_Document_Removed_Minute1, 00, $IN_Document_Removed_Month1, $IN_Document_Removed_Day1,$IN_Document_Removed_Year1);
}else{
if (empty($IN_Document_Removed_Hour1) AND ( !empty($IN_Document_Removed_Month1) && !empty($IN_Document_Removed_Day1) && !empty($IN_Document_Removed_Year))){
$IN_Document_Removed_Date1 = mktime (00, 00, 00, $IN_Document_Removed_Month1, $IN_Document_Removed_Day1, $IN_Document_Removed_Year1);
echo " Removed Date Will be Removed without hour and minute details becouse you did not set Removed Hour.<br>"; 
}else{
if ( empty($IN_Document_Removed_Minute1) AND ( !empty($IN_Document_Removed_Month1) && !empty($IN_Document_Removed_Day1) && !empty($IN_Document_Removed_Year1))){
$IN_Document_Removed_Date1 = mktime (00, 00, 00, $IN_Document_Removed_Month1, $IN_Document_Removed_Day1,$IN_Document_Removed_Year1);
echo " Removed Date Will be Removed without hour and minute details becouse you did not set Removed Minute.<br>"; 
}else{
if (empty($IN_Document_Removed_Month1) || empty($IN_Document_Removed_Day1) || empty($IN_Document_Removed_Year1)){
$IN_Document_Removed_Date1="";

			}
		}
	}
}

$sql = " UPDATE edocphp_main_out SET Document_U_No='$IN_Document_U_No', Document_Type='$IN_Document_Type', Document_From='$IN_Document_From', Document_From2='$IN_Document_From2', Document_Subject='$IN_Document_Subject', Document_To1='$IN_Document_To1', Document_To2='$IN_Document_To2', Document_To3='$IN_Document_To3', Document_To4='$IN_Document_To4', Document_To5='$IN_Document_To5', Document_Issued_Date='$IN_Document_Issued_Date', Document_Sent_Date='$IN_Document_Sent_Date', Document_Stored_Date='$IN_Document_Stored_Date1', Document_Physical_File='$IN_Document_Physical_File', Document_Path='$IN_Document_Path', Document_Details='$IN_Document_Details', Document_Actions_Needed='$IN_Document_Actions_Needed', Document_Actions_Performed='$IN_Document_Actions_Performed', Document_All_Actions_Completed='$IN_Document_All_Actions_Completed', Document_Comments='$IN_Document_Comments', Document_Removed='$IN_Document_Removed', Document_Removed_Reason='$IN_Document_Removed_Reason', Document_Removed_Date='$IN_Document_Removed_Date1', Document_Related='$IN_Document_Related' WHERE id='$idc'";

if (mysql_query($sql,$dbc)){
echo '<b><font color="#0000FF">Information Stored!</font></b><br><br>Select New Action from the panel above.';
} else {
$mysqlerror = mysql_error();
echo'<font color="FF0000"><b>Error</b>:</font> '.$mysqlerror.'';

echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
}
}

function select_removed(){
global $dbc;


$sql= "Select * From edocphp_main_in Where Document_Removed='YES'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows1 = mysql_num_rows($sql_res);


$sql= "Select * From edocphp_main_out Where Document_Removed='YES'";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);



echo'  <br><b>Select Removed Documents:</b>
  <form id="form" name="form" method="post" action="admin.php">
      <input name="op" type="radio" value="view_edit_removed" /> View Removed Documents from <b>Incoming</b> (We have '.$no_of_rows1.' Incoming Documents Removed). <br>
      <input name="op" type="radio" value="view_edit_removed_out" /> View Removed Documents from <b>Outgoing</b> (We have '.$no_of_rows.' Outgoing Documents Removed).<br>
    <input type="submit" name="Submit" value="GO" /></form>';
	
	echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br>";	

}

switch($op) {
    
	case "save_new_user":
    save_new_user();
    break;
	
	
	case "Update_User":
    Update_User();
    break;
	
	
	case "view_edit_remove_users":
    view_edit_remove_users();
    break;
	
	case "add_new_user":
    add_new_user();
    break;
	
	case "update_in":
    update_in();
    break;
	
		
	case "select_removed":
    select_removed();
    break;
	
	case "view_edit_removed":
    view_edit_removed();
    break;
	
	case "update_in_out":
    update_in_out();
    break;
	
	case "view_edit_removed_out":
    view_edit_removed_out();
    break;
	
	case "Delete_User_Final":
    Delete_User_Final();
    break;
	
	case "Delete_User":
    Delete_User();
    break;
	
    default:
    stats();
    break;	
}

include "footer.php";
 } else {
 die ("<br><b>Error: You Are not Administrator.</b>");
 }
?>

</body>
</html>
Return current item: Simple E-document