<?php session_start();  //Developed by ITechScripts
?>
<?
if(strlen($_SESSION["adminuser"])==0)
{
//echo '<meta http-equiv="refresh" content="0; url=index.php">';
//exit();
}
require 'include/configurations.php'; // ITECHBIDS Configuration File
require 'include/argvs.php'; // ITECHBIDS Configuration File
if(strlen($_POST['btn_Save'])) 
{
	$toh=$_POST['toh'];
	$tom=$_POST['tom'];
	$tos=$_POST['tos'];

	$fromh=$_POST['fromh'];
	$fromm=$_POST['fromm'];
	$froms=$_POST['froms'];

$totime="$toh:$tom:$tos";
$fromtime="$fromh:$fromm:$froms";
$sql=mysql_query("update closing set totime='$totime',fromtime='$fromtime' where auto=1");
}

$sql=mysql_query("select * from closing where auto=1");
$fromto=mysql_fetch_array($sql);
$totime = $fromto['totime'];
$fromtime = $fromto['fromtime'];

$totime1 = explode(":", $totime);
$fromtime1 = explode(":", $fromtime);

	$toh=$totime1[0];
	$tom=$totime1[1];
	$tos=$totime1[2];

	$fromh=$fromtime1[0];
	$fromm=$fromtime1[1];
	$froms=$fromtime1[2];
$currdate = date("H:i:s");
?>

<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
-->
</style><?php
require 'include/header.php';
?>
<br>
<table border="0" align="center" cellpadding="5" cellspacing="2" width="80%" class="ft">
<form name="frmPass" action="<? $_SERVER['PHP_SELF']?>" method="post">
<tr ><td colspan="2" class="ct" height="25">Set Auction Closing Time (Current Time: <?=$currdate?>)</td></tr>
<tr >
<td>From</td>
<td>
<select size="1" name="fromh">
<? for($i=0;$i<=23; $i++){ ?>
<? if($i<10){ 
$i="0".$i;
}?>
  <option value="<?=$i?>" <?if($i==$fromh){echo "selected";}?>><?=$i?></option>
<? } ?>
  </select> Hour &nbsp;

<select size="1" name="fromm">
<? for($i=0;$i<=59; $i++){ ?>
<? if($i<10){ 
$i="0".$i;
}?>
  <option value="<?=$i?>" <?if($i==$fromm){echo "selected";}?>><?=$i?></option>
<? } ?>
  </select> Minute &nbsp;

<select size="1" name="froms">
<? for($i=0;$i<=59; $i++){ ?>
<? if($i<10){ 
$i="0".$i;
}?>
  <option value="<?=$i?>" <?if($i==$froms){echo "selected";}?>><?=$i?></option>
<? } ?>
  </select> Second &nbsp;

</td>
</tr>
<tr >
<td>To</td>
<td>

<select size="1" name="toh">
<? for($i=0;$i<=23; $i++){ ?>
<? if($i<10){ 
$i="0".$i;
}?>
  <option value="<?=$i?>" <?if($i==$toh){echo "selected";}?>><?=$i?></option>
<? } ?>
  </select> Hour &nbsp;

<select size="1" name="tom">
<? for($i=0;$i<=59; $i++){ ?>
<? if($i<10){ 
$i="0".$i;
}?>
  <option value="<?=$i?>" <?if($i==$tom){echo "selected";}?>><?=$i?></option>
<? } ?>
  </select> Minute &nbsp;

<select size="1" name="tos">
<? for($i=0;$i<=59; $i++){ ?>
<? if($i<10){ 
$i="0".$i;
}?>
  <option value="<?=$i?>" <?if($i==$tos){echo "selected";}?>><?=$i?></option>
<? } ?>
  </select> Second &nbsp;
</td>
</tr>

<tr ><td colspan="2" align="center"><input type="submit" class="button"   name="btn_Save" value=" Change " ></td></tr>
</form>
</table>
<?
	require 'include/footer.php';
?>