<?php session_start();  //Developed by ITechScripts
require 'include/configurations.php'; // ITECHBIDS Configuration File
if($_GET[productid])
{
$_SESSION[productid]=$_GET[productid];
}
if($_GET[cat_id])
{
$_SESSION[cat_id]=$_GET[cat_id];
}
$productid=$_SESSION[productid];
$cat_id=$_SESSION[cat_id];
$postformat=$_SESSION[postformat];
if($postformat=="11")
{
$buy_time = "Time to buy";
$m_bid_amount = "Maximum Bid Amount";
$bid_change = "Bid Decrement";
}
if($postformat!="11")
{
$buy_time = "Reserved Price";
$m_bid_amount = "Minimum Bid Amount";
$bid_change = "Bid Increment";
}
$admin_start_sql="select * from genaralsettings where set_id=23";
$admin_start_res=mysql_query($admin_start_sql);
$admin_start_row=mysql_fetch_array($admin_start_res);
$admin_end_sql="select * from genaralsettings where set_id=24";
$admin_end_res=mysql_query($admin_end_sql);
$admin_end_row=mysql_fetch_array($admin_end_res);
$userid=$_SESSION[userid];
$category_id=$_SESSION[categoryid];
$cat_sql="select * from downcats where category_id=$category_id";
$res=mysql_query($cat_sql);
$row=mysql_fetch_array($res);
$tablename=$row[tablename];
$file_path=$row[file_path];
$flag=$_POST[flag];


if($mode == "repost"){

$edit="select * from auction_details where productid=$productid";
$modifyres=mysql_query($edit);
$modifyrow=mysql_fetch_array($modifyres);

$producttitle=$modifyrow['producttitle'];
$itemdes=$modifyrow[detailed_descrip];
$start_delay=$modifyrow[start_delay];
$currency=$modifyrow[currency];

$or_price=$modifyrow[or_price];
$return_pol=$modifyrow[return_pol];
$size_of_qty=$modifyrow[size_of_quantity];
$postmethod=$modifyrow[selling_method];
$quick=$modifyrow[quick_buy_price]; 
$min_amt=$modifyrow[min_bid_amount];
$rev_price=$modifyrow[reserve_price];
$bid_inc=$modifyrow[bidincrement];
$qty=$modifyrow[Quantity];

$discount=$modifyrow[discount];

}
if($flag==1)
{

$mode=$_POST[mode];
$productid=$_POST[productid];
$sub_cat=$_POST[cbosubcat];
$producttitle=$_POST[txttitle];
$producttitle=str_replace("'" , "\'" , $producttitle);

$qty=$_POST[txt_qty]; 

 if(empty($sub_cat))
 {
 $err_sub_cat="Please Select Category";
 $err_flag=1;
 }
if(stripslashes( $_POST[htmlcontent] ))
{
$itemdes=stripslashes( $_POST[htmlcontent] );
$itemdes=str_replace("'" , "\'" , $itemdes);
$_SESSION[des]=$itemdes;
}
else
$itemdes=$_SESSION[des];

$item_counter_style=$_POST['item_counter_style'];
$start_delay=$_POST['cbo_start_delay'];
if($_POST['cbocurrency'])
{
$currency=$_POST['cbocurrency'];
$_SESSION[currency]=$currency;
}
else
{
$currency=$_SESSION[currency];
}
$Gallery=$_POST['chkGallery'];
$Border=$_POST['chkBorder'];
$Highlight=$_POST['chkHighlight'];
$Privateauc=$_POST['chkPrivateauc'];
$postformat=$_SESSION[postformat];
$Bold=$_POST['chkBold'];
$Subtitle=$_POST['chkSubtitle'];
$Subtitle_name=$_POST['txtSubtitle'];
$Home=$_POST['chkHome'];



if(empty($producttitle))
{
 $err_title="Please Enter this Information";
	 $err_flag=1;
}

if(strlen($itemdes)==0)
{  
 $err_des="Please Enter this Information";
 $err_flag=1;
}
else
{
$err_flag=0;
}

$rel=$_POST[txt_rel];
$quick=$_POST[txt_quick];
$discount=$_POST[txt_discount];

if($postformat=="1")
{
$overimage="blank";
}
if($postformat=="2")
{
$overimage="penny";
}
if($postformat=="3")
{
$overimage="100";
}
if($postformat=="4")
{
$overimage="nail";
}
if($postformat=="5")
{
$overimage="fixed";
}
if($postformat=="6")
{
$overimage="beginner";
}
if($postformat=="7")
{
$overimage="10sec";
}
if($postformat=="8")
{
$overimage="15sec";
}
if($postformat=="9")
{
$overimage="20sec";
}
if($postformat=="11")
{
$overimage="blank";
}
if($_SESSION[postformat]==5)
{
if(empty($quick))
{
 $err_fix_price="Please Enter this Information";
 $err_flag=1;
}
}

 if(!empty($quick))
{
 if(!is_numeric($quick))
	{
      $err_fix_price="Your Quick Buy Price is invalid";
	  $err_flag=1;
	}
}

$min_amt=$_POST[txt_min_amt];
$rev_price=$_POST[txt_rev_price];
$bid_inc=$_POST[txt_bid_inc];
$repost=$_POST[repost];

if($repost=='Select Repost')
{

$err_repost="Please select Number of Repost";
$err_flag=1;
}

 if(empty($min_amt))
{
 $err_min_amt="Please Enter this Information";
	 $err_flag=1;
}
else
{
 if(!is_numeric($min_amt))
	{
      $err_min_amt="Your $m_bid_amount is invalid";
	  $err_flag=1;
	}
}

  if(!empty($rev_price))
{
 if(!is_numeric($rev_price))
	{
      $err_rev_price="Your reserve price is invalid";
	  $err_flag=1;
	}
}

 if(empty($bid_inc))
{
 $err_bid_inc="Please Enter this Information";
	 $err_flag=1;
}
else
{
 if(!is_numeric($bid_inc))
	{
      $err_bid_inc="Your $bid_change is invalid";
	  $err_flag=1;
	}
}

 

$days=$_POST[cbodays];
$mins=$_POST[cbomins];
$hours=$_POST[cbohours];
$secs=$_POST[cbosecs];


$delaydays=$_POST[delaydays];
$delaymins=$_POST[delaymins];
$delayhours=$_POST[delayhours];
$delaysecs=$_POST[delaysecs];


$daysadd=$_POST[cbodays2];
$minsadd=$_POST[cbomins2];
$hoursadd=$_POST[cbohours2];
$secsadd=$_POST[cbosecs2];

$timetoadd = $secsadd + ($minsadd*60) + ($hoursadd*3600) + ($daysadd*3600*24);


$or_price=$_POST[txt_or];

$return_pol=$_POST[txt_return];
$currency=$_POST['cbocurrency'];


 if(empty($days)&& empty($mins)&& empty($hours)&& empty($secs))
{
 $err_dur="Please Enter this Information";
	 $err_flag=1;
}

$srv = getcwd();
$srv=str_replace("/admin" , "/overlay" , $srv);
$srv = "$srv/";

$srv1 = getcwd();
$srv1=str_replace("/admin" , "/uploads" , $srv1);
$srv1 = "$srv1/";

$ref = $_SERVER["SERVER_NAME"];
$ref2 = $_SERVER["REQUEST_URI"];
$ref2=str_replace("/admin/postdetails.php" , "/uploads" , $ref2);

$dname = 'http://'.$ref2;

	$trans_r = 255;
	$trans_g = 255;
	$trans_b = 255;
	$cache_fs = "$srv1";
	$cache_uri = $dname;

        srand();
        $overlay = $srv.''.$overimage.'.png';
	$srid = substr(md5(rand(0,1000000)),0,10); 
	$base_fs = $cache_fs . $srid;
	$base_uri = $cache_uri . $srid;
if($_REQUEST['view'] == 'source') {
		$source = str_replace(' ', ' ', htmlspecialchars(implode('', file('index.php'))));
		$show = 'source';
	}
	else if(!$overlay = imagecreatefrompng($overlay)) {
		$error = 'error opening overlay image';
		$show = 'error';
	}
	else if(isset($_FILES['img1'])) {
		/*
		 * open original (uploaded) image, based on type.
		 */
		switch($_FILES['img1']['type']) {
			case 'image/jpeg':
			case 'image/pjpeg':
				$orig = imagecreatefromjpeg($_FILES['img1']['tmp_name']);
				break;
			case 'image/png':
				$orig = imagecreatefrompng($_FILES['img1']['tmp_name']);
				break;
			case 'image/gif':
				$orig = imagecreatefromgif($_FILES['img1']['tmp_name']);
				break;
			default:
				$error = 'Unknown File Format or MIME Type';
				$show = 'error';
		}

		if($orig) {
			$orig_x = imagesx($orig);
			$orig_y = imagesy($orig);
			$overlay_x = imagesx($overlay);
			$overlay_y = imagesy($overlay);
			$image_x = "400";
			$image_y = round(($orig_y * $image_x) / $orig_x);
			$thumb_y = round(($orig_y * $thumb_x) / $orig_x);

				$offset_x = $image_x - $overlay_x;
					$offset_y = $image_y - $overlay_y;
			$image = imagecreatetruecolor($image_x, $image_y);
			imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y);
if($overimage!=""){
			imagecolortransparent($overlay, imagecolorallocate($overlay, $trans_r, $trans_g, $trans_b));
			imagecolortransparent($overlay, imagecolorallocate($overlay, 0, 0, 0));
		        imagecopyresized($image, $overlay, 0, 0, 0, 0, $image_x, $image_y, $image_x, $image_y);
}
			imagepng($image, $base_fs . '-image.png');
			$image_uri = $base_uri . '-image.png';
		}
		else {
			if(!$error)
				$error = 'Error reading uploaded image';
			$show = 'error';
		}
	
		if(!isset($show))
			$show = 'result';
	}
$_SESSION[image1]=$srid.'-image.png';


        srand();
        $overlay = $srv.'s'.$overimage.'.png';
	$srid = substr(md5(rand(0,1000000)),0,10); 
	$base_fs = $cache_fs . $srid;
	$base_uri = $cache_uri . $srid;
if($_REQUEST['view'] == 'source') {
		$source = str_replace(' ', ' ', htmlspecialchars(implode('', file('index.php'))));
		$show = 'source';
	}
	else if(!$overlay = imagecreatefrompng($overlay)) {
		$error = 'error opening overlay image';
		$show = 'error';
	}
	else if(isset($_FILES['img2'])) {
		/*
		 * open original (uploaded) image, based on type.
		 */
		switch($_FILES['img2']['type']) {
			case 'image/jpeg':
			case 'image/pjpeg':
				$orig = imagecreatefromjpeg($_FILES['img2']['tmp_name']);
				break;
			case 'image/png':
				$orig = imagecreatefrompng($_FILES['img2']['tmp_name']);
				break;
			case 'image/gif':
				$orig = imagecreatefromgif($_FILES['img2']['tmp_name']);
				break;
			default:
				$error = 'Unknown File Format or MIME Type';
				$show = 'error';
		}

		if($orig) {
			$orig_x = imagesx($orig);
			$orig_y = imagesy($orig);
			$overlay_x = imagesx($overlay);
			$overlay_y = imagesy($overlay);
			$image_x = "100";
			$image_y = round(($orig_y * $image_x) / $orig_x);
			$thumb_y = round(($orig_y * $thumb_x) / $orig_x);

				$offset_x = $image_x - $overlay_x;
					$offset_y = $image_y - $overlay_y;
			$image = imagecreatetruecolor($image_x, $image_y);
			imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y);
if($overimage!=""){
			imagecolortransparent($overlay, imagecolorallocate($overlay, $trans_r, $trans_g, $trans_b));
			imagecolortransparent($overlay, imagecolorallocate($overlay, 0, 0, 0));
		        imagecopyresized($image, $overlay, 0, 0, 0, 0, $image_x, $image_y, $image_x, $image_y);
}
			imagepng($image, $base_fs . '-image.png');
			$image_uri = $base_uri . '-image.png';
		}
		else {
			if(!$error)
				$error = 'Error reading uploaded image';
			$show = 'error';
		}
	
		if(!isset($show))
			$show = 'result';
	}
$_SESSION[image2]=$srid.'-image.png';


        srand();
        $overlay = $srv.''.$overimage.'.png';
	$srid = substr(md5(rand(0,1000000)),0,10); 
	$base_fs = $cache_fs . $srid;
	$base_uri = $cache_uri . $srid;
if($_REQUEST['view'] == 'source') {
		$source = str_replace(' ', ' ', htmlspecialchars(implode('', file('index.php'))));
		$show = 'source';
	}
	else if(!$overlay = imagecreatefrompng($overlay)) {
		$error = 'error opening overlay image';
		$show = 'error';
	}
	else if(isset($_FILES['img3'])) {
		/*
		 * open original (uploaded) image, based on type.
		 */
		switch($_FILES['img3']['type']) {
			case 'image/jpeg':
			case 'image/pjpeg':
				$orig = imagecreatefromjpeg($_FILES['img3']['tmp_name']);
				break;
			case 'image/png':
				$orig = imagecreatefrompng($_FILES['img3']['tmp_name']);
				break;
			case 'image/gif':
				$orig = imagecreatefromgif($_FILES['img3']['tmp_name']);
				break;
			default:
				$error = 'Unknown File Format or MIME Type';
				$show = 'error';
		}

		if($orig) {
			$orig_x = imagesx($orig);
			$orig_y = imagesy($orig);
			$overlay_x = imagesx($overlay);
			$overlay_y = imagesy($overlay);
			$image_x = "400";
			$image_y = round(($orig_y * $image_x) / $orig_x);
			$thumb_y = round(($orig_y * $thumb_x) / $orig_x);

				$offset_x = $image_x - $overlay_x;
					$offset_y = $image_y - $overlay_y;
			$image = imagecreatetruecolor($image_x, $image_y);
			imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y);
if($overimage!=""){
			imagecolortransparent($overlay, imagecolorallocate($overlay, $trans_r, $trans_g, $trans_b));
			imagecolortransparent($overlay, imagecolorallocate($overlay, 0, 0, 0));
		        imagecopyresized($image, $overlay, 0, 0, 0, 0, $image_x, $image_y, $image_x, $image_y);
}
			imagepng($image, $base_fs . '-image.png');
			$image_uri = $base_uri . '-image.png';
		}
		else {
			if(!$error)
				$error = 'Error reading uploaded image';
			$show = 'error';
		}
	
		if(!isset($show))
			$show = 'result';
	}
$_SESSION[image3]=$srid.'-image.png';



        srand();
        $overlay = $srv.'s'.$overimage.'.png';
	$srid = substr(md5(rand(0,1000000)),0,10); 
	$base_fs = $cache_fs . $srid;
	$base_uri = $cache_uri . $srid;
if($_REQUEST['view'] == 'source') {
		$source = str_replace(' ', ' ', htmlspecialchars(implode('', file('index.php'))));
		$show = 'source';
	}
	else if(!$overlay = imagecreatefrompng($overlay)) {
		$error = 'error opening overlay image';
		$show = 'error';
	}
	else if(isset($_FILES['img4'])) {
		/*
		 * open original (uploaded) image, based on type.
		 */
		switch($_FILES['img4']['type']) {
			case 'image/jpeg':
			case 'image/pjpeg':
				$orig = imagecreatefromjpeg($_FILES['img4']['tmp_name']);
				break;
			case 'image/png':
				$orig = imagecreatefrompng($_FILES['img4']['tmp_name']);
				break;
			case 'image/gif':
				$orig = imagecreatefromgif($_FILES['img4']['tmp_name']);
				break;
			default:
				$error = 'Unknown File Format or MIME Type';
				$show = 'error';
		}

		if($orig) {
			$orig_x = imagesx($orig);
			$orig_y = imagesy($orig);
			$overlay_x = imagesx($overlay);
			$overlay_y = imagesy($overlay);
			$image_x = "100";
			$image_y = round(($orig_y * $image_x) / $orig_x);
			$thumb_y = round(($orig_y * $thumb_x) / $orig_x);

				$offset_x = $image_x - $overlay_x;
					$offset_y = $image_y - $overlay_y;
			$image = imagecreatetruecolor($image_x, $image_y);
			imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y);
if($overimage!=""){
			imagecolortransparent($overlay, imagecolorallocate($overlay, $trans_r, $trans_g, $trans_b));
			imagecolortransparent($overlay, imagecolorallocate($overlay, 0, 0, 0));
		        imagecopyresized($image, $overlay, 0, 0, 0, 0, $image_x, $image_y, $image_x, $image_y);
}
			imagepng($image, $base_fs . '-image.png');
			$image_uri = $base_uri . '-image.png';
		}
		else {
			if(!$error)
				$error = 'Error reading uploaded image';
			$show = 'error';
		}
	
		if(!isset($show))
			$show = 'result';
	}
$_SESSION[image4]=$srid.'-image.png';


        srand();
        $overlay = $srv.''.$overimage.'.png';
	$srid = substr(md5(rand(0,1000000)),0,10); 
	$base_fs = $cache_fs . $srid;
	$base_uri = $cache_uri . $srid;
if($_REQUEST['view'] == 'source') {
		$source = str_replace(' ', ' ', htmlspecialchars(implode('', file('index.php'))));
		$show = 'source';
	}
	else if(!$overlay = imagecreatefrompng($overlay)) {
		$error = 'error opening overlay image';
		$show = 'error';
	}
	else if(isset($_FILES['img5'])) {
		/*
		 * open original (uploaded) image, based on type.
		 */
		switch($_FILES['img5']['type']) {
			case 'image/jpeg':
			case 'image/pjpeg':
				$orig = imagecreatefromjpeg($_FILES['img5']['tmp_name']);
				break;
			case 'image/png':
				$orig = imagecreatefrompng($_FILES['img5']['tmp_name']);
				break;
			case 'image/gif':
				$orig = imagecreatefromgif($_FILES['img5']['tmp_name']);
				break;
			default:
				$error = 'Unknown File Format or MIME Type';
				$show = 'error';
		}

		if($orig) {
			$orig_x = imagesx($orig);
			$orig_y = imagesy($orig);
			$overlay_x = imagesx($overlay);
			$overlay_y = imagesy($overlay);
			$image_x = "400";
			$image_y = round(($orig_y * $image_x) / $orig_x);
			$thumb_y = round(($orig_y * $thumb_x) / $orig_x);

				$offset_x = $image_x - $overlay_x;
					$offset_y = $image_y - $overlay_y;
			$image = imagecreatetruecolor($image_x, $image_y);
			imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y);
if($overimage!=""){
			imagecolortransparent($overlay, imagecolorallocate($overlay, $trans_r, $trans_g, $trans_b));
			imagecolortransparent($overlay, imagecolorallocate($overlay, 0, 0, 0));
		        imagecopyresized($image, $overlay, 0, 0, 0, 0, $image_x, $image_y, $image_x, $image_y);
}
			imagepng($image, $base_fs . '-image.png');
			$image_uri = $base_uri . '-image.png';
		}
		else {
			if(!$error)
				$error = 'Error reading uploaded image';
			$show = 'error';
		}
	
		if(!isset($show))
			$show = 'result';
	}
$_SESSION[image5]=$srid.'-image.png';


        srand();
        $overlay = $srv.'s'.$overimage.'.png';
	$srid = substr(md5(rand(0,1000000)),0,10); 
	$base_fs = $cache_fs . $srid;
	$base_uri = $cache_uri . $srid;
if($_REQUEST['view'] == 'source') {
		$source = str_replace(' ', ' ', htmlspecialchars(implode('', file('index.php'))));
		$show = 'source';
	}
	else if(!$overlay = imagecreatefrompng($overlay)) {
		$error = 'error opening overlay image';
		$show = 'error';
	}
	else if(isset($_FILES['img6'])) {
		/*
		 * open original (uploaded) image, based on type.
		 */
		switch($_FILES['img6']['type']) {
			case 'image/jpeg':
			case 'image/pjpeg':
				$orig = imagecreatefromjpeg($_FILES['img6']['tmp_name']);
				break;
			case 'image/png':
				$orig = imagecreatefrompng($_FILES['img6']['tmp_name']);
				break;
			case 'image/gif':
				$orig = imagecreatefromgif($_FILES['img6']['tmp_name']);
				break;
			default:
				$error = 'Unknown File Format or MIME Type';
				$show = 'error';
		}

		if($orig) {
			$orig_x = imagesx($orig);
			$orig_y = imagesy($orig);
			$overlay_x = imagesx($overlay);
			$overlay_y = imagesy($overlay);
			$image_x = "100";
			$image_y = round(($orig_y * $image_x) / $orig_x);
			$thumb_y = round(($orig_y * $thumb_x) / $orig_x);

				$offset_x = $image_x - $overlay_x;
					$offset_y = $image_y - $overlay_y;
			$image = imagecreatetruecolor($image_x, $image_y);
			imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y);
if($overimage!=""){
			imagecolortransparent($overlay, imagecolorallocate($overlay, $trans_r, $trans_g, $trans_b));
			imagecolortransparent($overlay, imagecolorallocate($overlay, 0, 0, 0));
		        imagecopyresized($image, $overlay, 0, 0, 0, 0, $image_x, $image_y, $image_x, $image_y);
}
			imagepng($image, $base_fs . '-image.png');
			$image_uri = $base_uri . '-image.png';
		}
		else {
			if(!$error)
				$error = 'Error reading uploaded image';
			$show = 'error';
		}
	
		if(!isset($show))
			$show = 'result';
	}
$_SESSION[image6]=$srid.'-image.png';

 
  if($err_flag!=1)
  {
  if(!empty($sub_cat))
  $bid_starting_date=date("Y-m-d");
    
  if(!empty($sub_cat))  // check the user select the subcategory or not 
  $cat_id=$sub_cat;

   $_SESSION[cid]=$cat_id;
   $_SESSION[item_name]=$producttitle;
   $_SESSION[qty]=$qty;
   $_SESSION[des]=$itemdes;
   $_SESSION[currency]=$currency;
   $_SESSION[postmethod]=$postmethod;
   $_SESSION[min_amt]=$min_amt;  
   $_SESSION[bid_inc]=$bid_inc;
   $_SESSION[dur]=$dur;
   $_SESSION[timetoadd]=$timetoadd;


$_SESSION[delaydays]=$delaydays;
$_SESSION[delaymins]=$delaymins;
$_SESSION[delayhours]=$delayhours;
$_SESSION[delaysecs]=$delaysecs;



$_SESSION[days]=$days;
$_SESSION[mins]=$mins;
$_SESSION[hours]=$hours;
$_SESSION[secs]=$secs;
$_SESSION[or_price]=$or_price;
$_SESSION[return_pol]=$return_pol;
$_SESSION[rel]=$rel;
   $_SESSION[rev_price]=$rev_price;
   $_SESSION[bid_start]=$bid_starting_date;
   $_SESSION[quick_price]=$quick;
   $_SESSION[discount]=$discount;	  
   $_SESSION[sub_cat]=$sub_cat;
   $_SESSION[start_delay]=$start_delay;
 
   $_SESSION[Gallery]=$Gallery;
   $_SESSION[Border]=$Border;
   $_SESSION[Highlight]=$Highlight;
   $_SESSION[Privateauc]=$Privateauc;
   $_SESSION[Bold]=$Bold;
   $_SESSION[Home]=$Home;
  $_SESSION[img1]="";
  $_SESSION[img2]="";
  $_SESSION[img3]="";
  $_SESSION[img4]="";
  $_SESSION[img5]=""; 

	echo '<meta http-equiv="refresh" content="0;url=ship_itechd.php?productid='.$productid.'">';
	echo "$lang_675 <a href=ship_itechd.php?productid=$productid>Click here</a>";

  }
} //$flag==1

 ?>
 <? require 'include/header.php'; ?>
<html>
<head>
<title>Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body onload="javascript:chtype()">


  <table width="700" border="0" cellpadding="0" cellspacing="0" align="center">
    <tr>
    <td colspan=2 align="left" heught=25" class="ct" height="25">
	<? if($mode=="edit")
    echo "Edit Your Item"; 
    else if($mode=="repost")
    echo "Repost Your Item"; 
    else if($mode=="repost") 
    echo "Relist Your Item";
	else echo "Sell Your Item";
    ?> 
</td>
  </tr>

<tr><td>
<? if($err_flag==1)
{ 
?>
<table width="100%" align="center"><tr><td>
<img src="../images/xclabid.gif"></td>
<td><font size=2 color="red">The following must be corrected before continuing:</font></td>
<? if(!empty($err_title))
 {
 ?>
<tr><td>&nbsp;</td>
<td><a href="postdetails.php#txttitle">Item Title</a> - <?= $err_title; ?></td></tr>
<? 
}
?>
<? if(!empty($err_des))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#areades">Item Description</a> - <?= $err_des; ?></td></tr>
<? 
}
?>
<? if(!empty($err_min_amt))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#txt_min_amt"><?=$m_bid_amount?></a> - <?= $err_min_amt; ?></td></tr>
<? 
}
?>
<? if(!empty($err_fix_price))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#txt_quick">Quick Buy Price</a> - <?= $err_fix_price; ?></td></tr>
<? 
}
?>
<? if(!empty($err_rev_price))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#txt_rev_price">Reserve Price</a> - <?= $err_rev_price; ?></td></tr>
<? 
}
?>
<? if(!empty($err_qty))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#txt_qty">Quantity</a> - <?= $err_qty; ?></td></tr>
<? 
}
?>
<? if(!empty($err_dur))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#cbodur">Duration</a> - <?= $err_dur; ?></td></tr>
<? 
}
?>

<? if(!empty($err_sub_cat))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#cbosubcat">Sub Category</a> - <?= $err_sub_cat; ?></td></tr>
<? 
}
?>

<? if(!empty($err_bid_inc))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#txt_bid_inc"><?=$bid_change?></a> - <?= $err_bid_inc; ?></td></tr>
<? 
}
?>
<? if(!empty($err_cur))
 {
 ?>
<tr><td>&nbsp;</td>
<td><a href="postdetails.php#cbocurrency">Currency</a> - <?= $err_cur; ?></td></tr>
<? 
}
?>
<? if(!empty($err_img1))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#img1">Image1</a> - <?= $err_img1; ?></td></tr>
<? 
}
?>
<? if(!empty($err_img2))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#img2">Image2</a> - <?= $err_img2; ?></td></tr>
<? 
}
?>
<? if(!empty($err_img3))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#img3">Image3</a> - <?= $err_img3; ?></td></tr>
<? 
}
?>
<? if(!empty($err_img4))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#img4">Image4</a> - <?= $err_img4; ?></td></tr>
<? 
}
?>
<? if(!empty($err_img5))
 {
 ?>
<tr><td>&nbsp;</td><td><a href="postdetails.php#img5">Image5</a> - <?= $err_img5; ?></td></tr>
<? 
}
?>

<? if($tablename)
		{
		$tab_sql="select * from $tablename";
        $tab_res=mysql_query($tab_sql);
        $i =2; 
 while ($i < mysql_num_fields($tab_res))
{
    $tab_col = mysql_fetch_field($tab_res, $i);
	$dummy=$tab_col->name;
if(empty($_SESSION[$tab_col->name]))
        {
     ?>
	 
	  <tr><td>&nbsp;</td><td><a href="postdetails.php#<?= $tab_col->name ?>"><?= $tab_col->name ?></a>-Please Enter this Information </td></tr>
	 
	 <?
	    }
		else
		{
		 $var_type=$tab_col->type;
		if($var_type=="int" or $var_type=="tinyint")
		{
		if(!is_numeric($_SESSION[$tab_col->name]))
	    {
	    ?>
		 <tr><td>&nbsp;</td><td><a href="postdetails.php#<?= $tab_col->name ?>"><?= $tab_col->name ?></a>-Please Enter this Information </td></tr>
		<?
		}
		}
		}
	$i++;
}
}  ?>




</table></td></tr>
<tr><td>
<hr size="1" noshade class="hr_color"></td></tr>
<?
}
 ?>
<tr>
<td>
<form name="form1" action="postdetails.php" method=post enctype="multipart/form-data">
<table width="100%" cellpadding="5" cellspacing="2" >
 <?
  if($cat_id)
 {
  $sub_sql="select * from site_categories where category_head_id=$cat_id";
  $sub_res=mysql_query($sub_sql);
  $sub_tot=mysql_num_rows($sub_res);
 }
if($sub_tot!=0)
{ 
?>
<? 
  if(!empty($err_sub_cat))
  {
  ?>
  <img src="images/xclabids.gif">&nbsp;<font size=2 color=red>Please Select this Information</font>
  <br>
  <b><font size=2 color=red>Sub Category</font></b>
  <?
  }
  ?></td></tr><tr><td>
  <b><font size=2 >Sub Category</font></b>
<td width="470"><select name=cbosubcat><option value="0">Select</option>
<? while($sub_row=mysql_fetch_array($sub_res))
 {
  if(trim($sub_row['category_id'])==trim($sub_cat))
  {
   ?>
  <option value="<?= $sub_row['category_id'] ?>" selected><?= $sub_row['category_name']?></option>
  <? 
  }
  else
    {
	?>
  <option value="<?= $sub_row['category_id'] ?>"><?= $sub_row['category_name']?></option>
  <?
  }
  }
  ?>
  </select>
 </td></tr>
 <? 
 }
 else
 { ?>
  
  <?
  if($file_path)
 require "../$file_path";
   ?>
 
<? 
 }
 ?>
<tr><td>
<? if(!empty($err_title))
 {?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_title ?></font>
 <br>
 <b><font size=2 color=red>Item title</font></b>
 <?
  }
 ?></td></tr><tr><td>
   <b><font size=2 >Item title</font></b>
 </td><td><input type="text" class="bluetext"name="txttitle" class="txtbig" value="<?= $producttitle; ?>">
 </td></tr>
 <tr><td colspan="3">
<? if(!empty($err_des))
 {
 ?>
 <img src="images/xclabids.gif">&nbsp;
 <font size=2 color=red><?= $err_des; ?></font>
 <br>
 <b><font size=2 color=red>Item Description</font></b>
 <?
  }
   ?> </td></tr><TR><TD valign="top" colspan="3">
   <b><font size=2>Item Description</font></b>
 </td></tr><tr><td width="100%" colspan="3">
 <?php
include_once("../HTMLEditor/fckeditor.php") ;
?>
<?php
$oFCKeditor = new FCKeditor('htmlcontent') ;
$oFCKeditor->BasePath = '../HTMLEditor/' ;
$oFCKeditor->Value = $itemdes;
$oFCKeditor->Create() ;
?>
 <br>
<font size=2 class="hint_font">Describe your items features, benefits, 
and condition. Be sure to include in your description: Condition (new, used, etc.)</font></td>
</tr>
<tr>
                <td><font size=2 ><b>Item Hit Counter </b></font></td>
              <td>
<? 
if($item_counter_style==2)
{
 ?>
<input type="radio" name="item_counter_style" value=1 > 
 <b><font size=+1 color="#009900">
		    12345
			</font>
			</b> 
<input type="radio" name="item_counter_style" value=2 checked> 
<I><font size=+1 color="#003399">
		    12345
			</font>
			</I>  
<?
}
else
{
?>		 
<input type="radio" name="item_counter_style" value=1 checked> 
 <b><font size=+1 color="#009900">
		    12345
			</font>
			</b> 
<input type="radio" name="item_counter_style" value=2 > 
<I><font size=+1 color="#003399">
		    12345
			</font>
			</I>  
<?
}
?></td></tr>

<TR><TD>
<? if(!empty($err_dur))
 { 
 
 ?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_dur; ?></font>
 <br>
 <b><font size=2 color=red>Duration</font></b>
 <?
  }
 ?> </td>
</tr>

<TR><TD>
   <b><font size=2 >Duration</font></b></td>
<td width=250>
<select name="cbodays">
<option value="0" selected>Days</option>
<?
for($days1=1;$days1<=30;$days1++)
{
?>
<option value="<?= $days1; ?>" <? if($days1==$days){ echo "selected";}?>><?= $days1; ?> Day(s)</option>
<?
} 
?>
</select>
<select name="cbohours">
<option value="0" selected>Hours</option>
<?
for($hours1=1;$hours1<=24;$hours1++)
{
?>
<option value="<?= $hours1; ?>"<? if($hours1==$hours){ echo "selected";}?>><?= $hours1; ?> Hour(s)</option>
<?
} 
?>
</select>
<select name="cbomins">
<option value="0" selected>Minutes</option>
<?
for($mins1=1;$mins1<=60;$mins1++)
{
?>
<option value="<?= $mins1; ?>"<? if($mins1==$mins){ echo "selected";}?>><?= $mins1; ?> Minute(s)</option>
<?
} 
?>
</select>
<select name="cbosecs">
<option value="0" selected>Seconds</option>
<?
for($secs1=1;$secs1<=60;$secs1++)
{
?>
<option value="<?= $secs1; ?>"<? if($secs1==$secs){ echo "selected";}?>><?= $secs1; ?> Second(s)</option>
<?
} 
?>
</select>
</tr>


<TR><TD>
   <b><font size=2 >Posting Delay</font></b></td>
<td width=250>
<select name="delaydays">
<option value="0" selected>0 Days</option>
<?
for($days3=1;$days3<=30;$days3++)
{
?>
<option value="<?= $days3; ?>" <? if($days3==$daysd){ echo "selected";}?>><?= $days3; ?> Day(s)</option>
<?
} 
?>
</select>
<select name="delayhours">
<option value="0" selected>0 Hours</option>
<?
for($hours3=1;$hours3<=24;$hours3++)
{
?>
<option value="<?= $hours3; ?>"<? if($hours3==$hoursd){ echo "selected";}?>><?= $hours3; ?> Hour(s)</option>
<?
} 
?>
</select>
<select name="delaymins">
<option value="0" selected>0 Minutes</option>
<?
for($mins3=1;$mins3<=60;$mins3++)
{
?>
<option value="<?= $mins3; ?>"<? if($mins3==$minsd){ echo "selected";}?>><?= $mins3; ?> Minute(s)</option>
<?
} 
?>
</select>
<select name="delaysecs">
<option value="0" selected>0 Seconds</option>
<?
for($secs3=1;$secs3<=60;$secs3++)
{
?>
<option value="<?= $secs3; ?>"<? if($secs3==$secsd){ echo "selected";}?>><?= $secs3; ?> Second(s)</option>
<?
} 
?>
</select>
</tr>







<TR><TD>
 <b><font size=2 >Quantity</font></b>
 </td>
 <td><input type="text" class="bluetext"name="txt_qty" class="txtsmall" value=<?= $qty; ?>></td></tr>
<tr><td width="250">
 <? if(!empty($err_min_amt))
 {
 ?>
 <img src="images/xclabids.gif">
 &nbsp;<font size=2 color=red><?= $err_min_amt?></font>
 <br>
 <b><font size=2 color=red><?=$m_bid_amount?></font></b>
 <?
 }
 ?></td></tr><TR><TD>
 <b><font size=2 ><?=$m_bid_amount?></font></b>
 </td>
 <td><input type="text" class="bluetext"name="txt_min_amt" class="txtsmall" value=<?= $min_amt; ?>></td></tr>
<tr><td>
<? if(!empty($err_bid_inc))
 {?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_bid_inc?></font>
 <br>
 <b><font size=2 color=red><?=$bid_change?></font></b>
 <?
  }
 ?> </td></tr><TR><TD>
   <b><font size=2><?=$bid_change?></font></b>
</td><td><input type="text" class="bluetext"name="txt_bid_inc" class="txtsmall" value=<?= $bid_inc; ?>></td></tr>
<?
if($_SESSION[postformat]!=11)
{?>
<TR><TD>
   <b><font size=2 >Time added on each bid</font></b></td>
<td width=250>
<select name="cbodays2">
<option value="0" selected>Days</option>
<?
for($days2=1;$days2<=30;$days2++)
{
?>
<option value="<?= $days2; ?>" <? if($days2==$daysadd){ echo "selected";}?>><?= $days2; ?> Day(s)</option>
<?
} 
?>
</select>
<select name="cbohours2">
<option value="0" selected>Hours</option>
<?
for($hours2=1;$hours2<=24;$hours2++)
{
?>
<option value="<?= $hours2; ?>"<? if($hours2==$hoursadd){ echo "selected";}?>><?= $hours2; ?> Hour(s)</option>
<?
} 
?>
</select>
<select name="cbomins2">
<option value="0" selected>Minutes</option>
<?
for($mins2=1;$mins2<=60;$mins2++)
{
?>
<option value="<?= $mins2; ?>"<? if($mins2==$minsadd){ echo "selected";}?>><?= $mins2; ?> Minute(s)</option>
<?
} 
?>
</select>
<select name="cbosecs2">
<option value="0" selected>Seconds</option>
<?
for($secs2=1;$secs2<=60;$secs2++)
{
?>
<option value="<?= $secs2; ?>"<? if($secs2==$secsadd){ echo "selected";}?>><?= $secs2; ?> Second(s)</option>
<?
} 
?>
</select>
</tr>
<? } ?>
<?
if($_SESSION[postformat]==5)
{?>
<TR><TD>
   <b><font size="2" color="red"><b>Fixed Price:</b></font></b>
 </td>
 <td>
<input type="text" class="bluetext"name="txt_quick" class="txtsmall" value="<?= $quick; ?>"></td></tr>
<? } ?>

<TR><TD>
   <b><font size=2><?=$buy_time?></font></b>
 </td>
 <td>

<input type="text" class="bluetext"name="txt_rev_price" class="txtsmall" value=<?= $rev_price; ?>></td></tr>


<TR><TD>
   <b><font size=2>Original Price</font></b>
 </td>
 <td>

<input type="text" class="bluetext"name="txt_or" class="txtsmall" value=<?= $or_price; ?>></td></tr>

<TR><TD valign="top">
   <b><font size=2>Return Policy</font></b>
 </td>
 <td>

<textarea name="txt_return" class="txtsmall" rows="6" cols="31"><?= $return_pol; ?></textarea></td></tr>
 
<tr class="tr_border" width=758><td colspan="2"><font size="2"><b>Add Images</b></font></td></tr>
<tr><td colspan="3">
<? if(!empty($err_img1))
 {?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_img1; ?></font>
 <br>
 <b><font size=2 color=red>Image</font></b>
 <?
  }
  else
  {
 ?>
   <b><font size=2 >Image</font></b>
   <? 
   }
   ?>
    <input type="file" name="img1" value="<?= $img1; ?>">
	<? if(!empty($_SESSION[img1]))
	{
	?>
	<img src="images/gallery.png" width=10 height=10>
	<?
	}
	?></td></tr>
	<tr><td colspan="3">
  <? if(!empty($err_img2))
  {
  ?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_img2; ?></font>
 <br>
 <b><font size=2 color=red>Thumbnail</font></b>
 <?
  }
  else
  {
 ?>
   <b><font size=3 >Thumbnail</font></b>
   <? }
   ?>
    <input type="file" name="img2" value=<?= $img2; ?>>
	<? if(!empty($_SESSION[img2]))
	{
	?>
	<img src="images/gallery.png" width=10 height=10>
	<?
	}
	?></td></tr>

<tr><td colspan="3">
<? if(!empty($err_img3))
 {?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_img3; ?></font>
 <br>
 <b><font size=2 color=red>Image</font></b>
 <?
  }
  else
  {
 ?>
   <b><font size=2 >Image</font></b>
   <? 
   }
   ?>
    <input type="file" name="img3" value="<?= $img3; ?>">
	<? if(!empty($_SESSION[img3]))
	{
	?>
	<img src="images/gallery.png" width=10 height=10>
	<?
	}
	?></td></tr>
	<tr><td colspan="3">
  <? if(!empty($err_img4))
  {
  ?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_img4; ?></font>
 <br>
 <b><font size=2 color=red>Thumbnail</font></b>
 <?
  }
  else
  {
 ?>
   <b><font size=3 >Thumbnail</font></b>
   <? }
   ?>
    <input type="file" name="img4" value=<?= $img4; ?>>
	<? if(!empty($_SESSION[img4]))
	{
	?>
	<img src="images/gallery.png" width=10 height=10>
	<?
	}
	?></td></tr>

<tr><td colspan="3">
<? if(!empty($err_img5))
 {?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_img5; ?></font>
 <br>
 <b><font size=2 color=red>Image</font></b>
 <?
  }
  else
  {
 ?>
   <b><font size=2 >Image</font></b>
   <? 
   }
   ?>
    <input type="file" name="img5" value="<?= $img5; ?>">
	<? if(!empty($_SESSION[img5]))
	{
	?>
	<img src="images/gallery.png" width=10 height=10>
	<?
	}
	?></td></tr>
	<tr><td colspan="3">
  <? if(!empty($err_img6))
  {
  ?>
 <img src="images/xclabids.gif">&nbsp;<font size=2 color=red><?= $err_img6; ?></font>
 <br>
 <b><font size=2 color=red>Thumbnail</font></b>
 <?
  }
  else
  {
 ?>
   <b><font size=3 >Thumbnail</font></b>
   <? }
   ?>
    <input type="file" name="img6" value=<?= $img6; ?>>
	<? if(!empty($_SESSION[img6]))
	{
	?>
	<img src="images/gallery.png" width=10 height=10>
	<?
	}
	?></td></tr>

	<input type=hidden name="highlight" value="<? if(($member_type==1)||($member_type==2)) echo $highret; ?>">
    <input type="hidden" name=flag value="1">
	<input type="hidden" name="cat_id" value=<?= $cat_id; ?>>
	<input type="hidden" name=mode value="<?= $mode; ?>">
		<input type="hidden" name=postformat value="<?= $postformat; ?>">
	<input type="hidden" name=productid value=<?= $productid; ?>>
    <tr><td colspan="2" align="center">
	<? if($mode=="" or $mode=="relist" or $mode=="repost")
	{
	?>
	<input type="submit" class="button"   name=detsub value=Continue>
	<?
	}
	else if($mode=="change")
	{ 
	?>
	<input type="submit" class="button"   name=detsub value="Save" class="buttonbig">
    <?
	}
	?></td></tr>
   </table>
   </form>

<? require 'include/footer.php'?>
</table>

<script language="javascript">
function sel_method()
{
document.form1.radselling.value="auction";
document.form1.flag.value=2;
document.form1.submit();
}
</script>
  </body>
</html>
