<?php session_start();  //Developed by ITechScripts?>
<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
.style3 {color: #666666; font-size: 11px; font-family:Arial, Helvetica, sans-serif}
-->
</style>
><?php
require 'include/configurations.php'; // ITECHBIDS Configuration File
require 'include/header.php';
$userid=$_SESSION['userid'];
$mode=$_GET[mode];
     $user_id=$_SESSION[userid];
	 $cansave=$_POST[cansave];
     $myquery="select * from shopfronts where user_id='$user_id'";
	$mytab=mysql_query($myquery);
    $count=mysql_num_rows($mytab);
	if($cansave!=1)
	{
	$row=mysql_fetch_array($mytab);
	$shop_name=$row[shop_name];
	$itemdes=$row[description];
    $aboutpage_type=$row[status];
	$aboutpage_type=$row[status];
	$logo=$row[logo];
	}
	if($cansave==1)
	{
  $shop_name=$_POST[shop_name];
  $itemdes=stripslashes( $_POST[htmlcontent] );
  $aboutpage_type=$_POST[aboutpage_type];
  $logo1=$_FILES['logo']['name'];
  if($logo1)
  $logo=$logo1;
                     $uploaddir= getcwd(); 
 					 $updir=explode('/',$uploaddir);
					 $count=count($updir)-1;
					 for($i=0;$i<$count;$i++)
					 {
         			 $up_dir.=$updir[$i]."/";
					 }
$uploaddir=rtrim($up_dir,"/");
if(!empty($logo))
{
 $type1=$_FILES['logo']['type'];
 if($type1=="image/pjpeg" || $type1=="image/gif" || $type1=="image/jpeg" || $type1=="image/bmp")
 {
  
  $logo=urlencode($logo);
  $logo="$user_id"."$logo";
  $uploaddir="shopimages/$logo";
  move_uploaded_file($_FILES['logo']['tmp_name'],$uploaddir);
  //$_logo_name=$_FILES['logo']['name'];
 //s $logo=$_FILES['logo']['name'];
  
 }
 }
    
	if($count==0)
	{
    $query="insert into shopfronts         (user_id,logo,description,shop_name,status)values('$user_id','$logo','$itemdes','$shop_name','$aboutpage_type')";
     mysql_query($query);
    }
	else
	{
	 if($logo=="")
	 $query="update shopfronts set description ='$itemdes',shop_name='$shop_name' where user_id='$user_id'";
	 else
	 $query="update shopfronts set logo='$logo', description ='$itemdes',shop_name='$shop_name' where user_id='$user_id'";
	 
	 mysql_query($query);
  	}
	} //  if($cansave==1)
?>			 
 <table width="758" border="0" cellpadding="0" cellspacing="0" align="center" >
  <tr><td valign="top" class="table_border">
  <table border="0" align="center" cellpadding="3" cellspacing="0" width="100%">
  <tr> 
     <td colspan="2">
<TABLE cellSpacing=5 cellPadding=0 width=100%
            border=0 align="left" bgcolor="white">
              <TBODY>
                      <TR class=c2>
                      <TD width="150" align="right">
					  <STRONG>SHOP STATUS</STRONG>:</TD><td><IMG 
                        hspace=4 src="../images/<? if($aboutpage_type=='enable') echo 'active.gif'; else echo 'inactive.gif'; ?>" ><SPAN 
                        class=redfont><? if($aboutpage_type=='enable') echo "<font color=green>inactive </font>"; else echo "<font color=red>active </font>"; ?> </SPAN></TD>
                      <!-- <TD width="33%"><STRONG>LAST PAYMENT</STRONG>: n/a</TD>
                      <TD width="33%"><STRONG>NEXT PAYMENT</STRONG>: 
                    n/a</TD> --> </TR></TBODY></TABLE></TD></TR>
				<TR>
                <TD class=c4>
			<FORM action=shops.php method=post 
            encType=multipart/form-data name=form1>
			<INPUT type=hidden name=oldlogo> 
			<TABLE class=border cellSpacing=4 cellPadding=4 width="100%" 
            border=0>
              <TBODY>
              <TR class=c3>
                <TD class=contentfont align=right width=150><B>Enable Shop</B></TD>
                <TD class=contentfont>
				  <? 
				  if($aboutpage_type=="enable")
				  {
				  ?>
				  <INPUT type=radio value="enable"
                  name=aboutpage_type checked="checked" /> Yes 
				 <?
				 }
				 else
				 {
				 ?> 
				  <INPUT type=radio value="enable"
                  name=aboutpage_type> Yes 
				 <?
				 }
				 ?>
 				  <? if($aboutpage_type=="disable")
				  {
				  ?>
				  <INPUT type=radio value="disable"
                  name=aboutpage_type checked="checked"> No
				 <?
				 }
				 else
				 {
				 ?> 
				  <INPUT type=radio value="disable"
                  name=aboutpage_type> No
				 <?
				 }
				 ?>
    		 </TD></TR>
              <TR class=c2>
                <TD width=150></TD>
                <TD class=contentfont>By enabling the SHOP page, you will 
                  have the option to list a number of auctions on the newly 
                  created shop section.</TD></TR>
                        <TR class=c2>
                <TD class=contentfont align=right><B>Shop Name</B></TD>
                <TD class=contentfont><INPUT  id=shop_name 
                  maxLength=50 size=50 name=shop_name value="<?= $shop_name ?>"></TD></TR>
    			  <TD class=contentfont align=right><B>Shop Name</B></TD>
                <TD class=contentfont><INPUT  id=shop_name 
                  maxLength=50 size=50 name=shop_name value="<?= $shop_name ?>"></TD></TR>
              <TR class=c2>
                <TD class=contentfont vAlign=top align=right><B>Shop 
                  Description</B></TD>
                <TD class=contentfont>
				<!-- <TEXTAREA id=content name=content rows=10 cols=45></TEXTAREA> -->
	<?php
include_once("../HTMLEditor/fckeditor.php") ;
?>
<?php
$oFCKeditor = new FCKeditor('htmlcontent') ;
$oFCKeditor->BasePath = '/HTMLEditor/' ;
$oFCKeditor->Value = $itemdes;
$oFCKeditor->Create() ;
?>

   </TD></TR>
				<?
				if($logo)
				{
				?>   
				<TR class=c3>
                <TD class=contentfont align=right><B>Current Logo</B></TD>
                <TD class=contentfont><img src="shopimages/<?= $logo ?>" /></TD></TR>
				<?
				}
				?>  
                <TR class=c3>
                <TD class=contentfont align=right><B>Upload Shop Logo</B></TD>
                <TD class=contentfont><INPUT id=logo type=file size=40 
                  name=logo></TD></TR>
                <TR class=c4>
                <TD class=contentfont align=middle colSpan=2>
				<input type="hidden" name="cansave" value=1>
				<INPUT type=submit value="Save Settings" name=shopsaveok></TD></TR></TBODY></TABLE>
				</FORM></TD></TR></TBODY></TABLE><BR>	
 
  </td></tr>
</table>
<? require 'include/footer.php'; ?>
  </body>
</html>
