 <?php require_once('../Connections/BE2.php'); ?>
 <? 
 
mysql_select_db($database_BE2, $BE2);
$query_Rt3 = sprintf("SELECT * FROM webshop WHERE coid= 1 OR coid='%s' order by coid,windex",$_SESSION['shop_id']) ; 
$Rt3 = mysql_query($query_Rt3, $BE2) or die(mysql_error());
$row_Rt3 = mysql_fetch_assoc($Rt3);
$totalRows_Rt3 = mysql_num_rows($Rt3);

// if (  $_SERVER['REMOTE_ADDR']=='220.130.43.118'){  
//      echo $query_Rt3."<br>" ;
	 
 // } 

$arr1=array();
$coid=$row_Rt3['coid'];
$i=0;
do {   
    //if($row_Rt3['coid']==1){$i=$row_Rt3['windex']-1;} 
	$i=$row_Rt3['windex']-1; 
	//if(($row_Rt3['coid']>1 )&& ($row_Rt3['wflag']>0)){ $i=$row_Rt3['windex']-1;}
    $arr1[$i][0]=$row_Rt3['wid']; 
	$arr1[$i][1]=$row_Rt3['coid'];
    $arr1[$i][2]=$row_Rt3['wtitle'];
	$arr1[$i][3]=$row_Rt3['wimg'].'.'.$row_Rt3['wimgext'];
	$arr1[$i][4]=$row_Rt3['wlink'];
	$arr1[$i][5]=$row_Rt3['wuse']; // can edit upload 
	$arr1[$i][6]=$row_Rt3['wflag']; // can edit upload 
	$coid=max($coid,$row_Rt3['coid']);
 }  while ($row_Rt3 = mysql_fetch_assoc($Rt3));
 
//$arr1[0][4]='/showproducts/'.$_SESSION['shop_name'].'.html'; //醄醴敬妻泡菜.html
//$arr1[0][4]='/shop/'.$_SESSION['shop_name'].'.html?li=Product';  //醄醴敬妻泡菜.html 我的商品
$arr1[1][4]='/shop/'.$_SESSION['shop_name'].'.html?li=Profile';  //醄醴敬妻泡菜.html 公司簡

mysql_select_db($database_BE2, $BE2);
$query_Rt4 = sprintf("SELECT * FROM shop5 WHERE si10b='%s' ",$coid) ; 
$Rt4 = mysql_query($query_Rt4, $BE2) or die(mysql_error());
$row_Rt4 = mysql_fetch_assoc($Rt4);
$totalRows_Rt4 = mysql_num_rows($Rt4);

 
$arr1[4][4]='/search.html?search2=街道網店商城&keyword='.$row_Rt4['si6a']."#".$row_Rt4['si5'] ;//#天空商城; //醄醴敬妻泡菜.html

//$_SESSION['shop_name']
// Profile, Product
   for($i=0;$i<9;$i++){ 
    if( $arr1[$i][6]>0){
   ?>
       <div class="col-md-4 col-xs-4 col-sm-4">
       <div class="thumbnail">
          <a href="<?= ($arr1[$i][4]=="")?"#":$arr1[$i][4] ; ?>" target="_self"><img src="/shop/img/<?= $arr1[$i][3]?>" alt="<?= $arr1[$i][2];?>" title="<?= $arr1[$i][2];?>" /></a>
           
       </div>
            <div style="text-align:center;font-size:14px"><?= $arr1[$i][2];?></div> 
       </div>
    <?
	  $c=$i+1;
	  if($c %3 ==0){ echo '<div class="clearfix"> </div>'; }
	
	  } // end wflag>0 
	}   ?>     
         
        	 <div class="clearfix"> </div>
 
<?php
mysql_free_result($Rt3);

mysql_select_db($database_BE2, $BE2);
$query_Rt4 = sprintf("SELECT * FROM ecardext WHERE wflag=1 and wkid=2 and wuid='%s' order by windex",$_SESSION['shop_id']) ; 
$Rt4 = mysql_query($query_Rt4, $BE2) or die(mysql_error());
$row_Rt4 = mysql_fetch_assoc($Rt4);
$totalRows_Rt4 = mysql_num_rows($Rt4);
 
 if($totalRows_Rt4>0){
   $cl=0;	   
   do { 
     $wtitle= $row_Rt4['wtitle'] ;
	 $wimg= $row_Rt4['wimgext']==''?"blank.jpg": $row_Rt4['wimg'].'.'.$row_Rt4['wimgext'];
	 $wlink=($row_Rt4['wlink']=='')?'#':$row_Rt4['wlink'] ;//   $row_Rt3['wlink']:"";"./".$scode.'-'.($i+1)
    ?>
    <div class="col-md-4 col-xs-4 col-sm-4">
       <div class="thumbnail">
        <a href="<?= $wlink;?>" target="_self"><img src="/ecard/reimg/<?= $wimg ?>" title="<?= $wtitle;?>" width="100%"/></a>
       </div>
            <div style="text-align:center;font-size:14px"><?=  $wtitle ;?></div> 
       </div>
         <? $cl++;  
	    if(( $cl% 3)==0 ){ ?> <div class="clearfix"> </div> <? }  ?>  
 
  <? }  while ($row_Rt4 = mysql_fetch_assoc($Rt4));
  
 } // end $totalRows_Rt4

mysql_free_result($Rt4);
 
  ?>  
  
  <div class="clearfix"> </div>      