<?
ob_start();
session_start();
 include("../include/db.inc.php"); 
 include("function_img.php"); 
   $db1=new db;
   $db1->open();
    mysql_query("SET NAMES 'utf8'");
   if($_SESSION['uname']=='' || $_SESSION['pwd']=='')
		{
			header("location:login.php");
		}
   if(isset($_POST['submit'])){
   
  
			$bid_ins="insert into auction_type set range_min='".$_POST['min_bid']."', range_max='".$_POST['max_bid']."', 
			price_increment='".$_POST['price_increment']."',time_increment='".$_POST['time_increment']."',auction_type='".$_POST['auction_type']."'";
				
			mysql_query($bid_ins);
				header("location:auction_increment.php");
			}
			
			 if(isset($_POST['update'])){
   
  
			$bid_ins="update auction_type set range_min='".$_POST['min_bid']."', range_max='".$_POST['max_bid']."', 
			price_increment='".$_POST['price_increment']."',time_increment='".$_POST['time_increment']."',auction_type='".$_POST['auction_type']."' 
			where id=".$_POST['id'];
				
			mysql_query($bid_ins);
				header("location:auction_increment.php");
			}
			
			
			
			
			if(isset($_GET['edit'])){
			
			$sql_show="select * from auction_type where id=".$_GET['edit'];
			$aquery=mysql_query($sql_show);
			
			$myrow=mysql_fetch_array($aquery);
			}
	
   
?>

<!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=utf-8" />
<title>Money Auctions | Admin Controls</title>
<link href="index.css" rel="stylesheet" type="text/css" />
<script src="../include/validation.js"></script>
<script language="javascript">
function validate()
{
   if(document.form1.min_bid.value=='')
	
		{
		alert("Please enter the min bid !");
		document.form1.min_bid.focus();
		return false;
		}
	
		if(document.form1.max_bid.value=='')
	
		{
		alert("Please enter the max bid !");
		document.form1.max_bid.focus();
		return false;
		}
	
		if(document.form1.price_increment.value=='')
	
		{
		alert("Please enter the Price Increment !");
		document.form1.price_increment.focus();
		return false;
		}
	
	
		if(document.form1.time_increment.value=='')
	
		{
		alert("Please enter the Time Increment !");
		document.form1.time_increment.focus();
		return false;
		}
	
	
	
		if(document.form1.auction_type.value==0)
	
		{
		alert("Please select the auction type !");
		document.form1.auction_type.focus();
		return false;
		}
	
	
	
	
		return true;
		
}
     
</script>
</head>
<body bgcolor="#ffffff">
<div class="admin_wrapper">
<div class="logo_show"><? include("minorlogout.php");?></div>
<div style="float:left; width:200px">
<div class="topg_links_show"><? include("left.php");	?></div>
<div class="top_links_show"><? include("belowleft1.php");	?></div></div>
<div style="float:left; width:800px">
<div class="maximum">

<table width="78%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" align="center">
        <tr>
          <td width="10" align="center" valign="top">&nbsp;</td>
          <td align="center" valign="top"><table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
              <tr>
                <td width="1" valign="top">&nbsp;</td>
                <td valign="top"><br>
                  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
                    <tr>
                      <td width="33" valign="top"><img src="img/03.gif" width="33" height="23"></td>
                      <td background="img/bg01.gif"><strong>&nbsp;AUCTION TYPE INCREMENT</strong></td>
                      <td width="35"><img src="img/04.gif" width="35" height="23"></td>
                    </tr>
                  </table>
                  <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
                    <tr>
                      <td width="22" valign="top" background="img/tbl-left04.gif"><img src="img/tbl-left04.gif" width="22" height="13"></td>
                      <td valign="top" align="center"><br>
                        <br>
                        <FORM ACTION="" METHOD="post" enctype="multipart/form-data" name="form1" onsubmit="return validate();" >
						<input type="hidden" name="id" value="<?=$myrow['id']?>" />
                          <table width="60%"  border="0" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC" align="center">
                            <tr bgcolor="#FFFFFF">
                              <td class="txt" style="padding-left:10px;">No. of Min Bids </td>
                              <td style="padding-left:10px;">
							 <input name="min_bid" type="text" value="<?=$myrow['range_min']?>" />
							  </td>
                            </tr>
							<tr bgcolor="#FFFFFF">
                              <td class="txt" style="padding-left:10px;">No. of Max Bids </td>
                              <td style="padding-left:10px;">
							 <input name="max_bid" type="text" value="<?=$myrow['range_max']?>"/>
							  </td>
                            </tr>
							<tr bgcolor="#FFFFFF">
                              <td class="txt" style="padding-left:10px;">Price Increment </td>
                              <td style="padding-left:10px;">
							 <input name="price_increment" type="text" value="<?=$myrow['price_increment']?>"/>
							  </td>
                            </tr>
							<tr bgcolor="#FFFFFF">
                              <td class="txt" style="padding-left:10px;">Time Increment </td>
                              <td style="padding-left:10px;">
							 <input name="time_increment" type="text" value="<?=$myrow['time_increment']?>"/>
							  </td>
                            </tr>
							<tr bgcolor="#FFFFFF">
                              <td class="txt" style="padding-left:10px;">Auction Type </td>
                              <td style="padding-left:10px;">
							  <select name="auction_type">
							  <option value="0">--select type of auctions--</option>
								<option value="1" <? if($myrow['auction_type']=='1') { echo "selected";}?>>Other Auctions </option>
							    <option value="2" <? if($myrow['auction_type']=='2') { echo "selected";}?>> Penny Auctions </option>
							 </select>
							  </td>
                            </tr>
                            <tr>
                              <td align="center" bgcolor="#EDEDED" colspan="2">
							<?  if(isset($_GET['edit'])){?>
							<input name="update" type="submit" class="buttons" value="Update">
							  <? }else{?>
							  <input name="submit" type="submit" class="buttons" value="Save">
							  <? }?>
							  &nbsp;&nbsp;
                                <input name="back" type="button" class="buttons" onClick="window.location.href='auction_increment.php'" value="Back To List">
                              </td>
                            </tr>
                          </table>
                        </FORM>
                        <br>
                      </td>
             <td width="19" valign="top" background="img/tbl-right04.gif"><img src="img/tbl-right04.gif" width="19" height="9"></td>
                    </tr>
                  </table>
                  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
                    <tr>
                      <td width="33"><img src="img/tbl-bot01.gif" width="33" height="12"></td>
                      <td align="right" background="img/tbl-bg.gif"><img src="img/tbl-right05.gif" width="35" height="12"></td>
                    </tr>
                  </table></td>
                <td width="20" valign="top">&nbsp;</td>
              </tr>
            </table>
           
          </td>
        </tr>
      </table>

</div></div>
<div class="bottom_links_show"><? include("footer.php");	?></div>

</html>
</div>
</body>
</html>
