⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 view_product1.php

📁 通达OA部分源代码
💻 PHP
字号:
<?php
include_once "myconnect.php";
include_once "date_time_format.php";


if(!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id']) || ($_REQUEST['id'] == 0) )
{
	header("Location: index.php?msg=".urlencode("Invalid access, denied"));
	die();
}

$id=$_REQUEST['id'];

$sbq_off="select *,UNIX_TIMESTAMP(sb_postedon) as sbposted from sbbleads_products where sb_id=$id and sb_approved='yes'";
//die($sbq_off);
$sbrow_off=mysql_fetch_array(mysql_query($sbq_off));
if(!$sbrow_off)
{
	header("Location: index.php?msg=".urlencode("No such product catalog exists or disabled by admin"));
	die();
}
///////////------updating view count
$sbqu_off="update sbbleads_products set sb_viewed=sb_viewed+1 where sb_id=$id";
mysql_query($sbqu_off);

//////////---------
function main()
{
	global $sbrow_off, $id;
	
	$config=mysql_fetch_array(mysql_query("select * from sbbleads_config"));

$cid=0;
$keyword="";

	if(isset($_REQUEST["cid"])&&($_REQUEST["cid"]<>""))
	{
	$cid=$_REQUEST["cid"];
	}

	if(isset($_REQUEST["keyword"])&&($_REQUEST["keyword"]<>""))
	{
		$keyword=$_REQUEST["keyword"];
	}


	$catname="";
	$category=0;
  
  	$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $cid );
	if ($cat=mysql_fetch_array($cat_query))
	{
	$catname=$cat["sb_cat_name"];
	$category=$cat["sb_id"];
	}

	$catpath="";
  	$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $cid );
	while ($rs=mysql_fetch_array($cat_query))
    {
    $catpath =" > <a href=\"cat_sell.php?cid=" . $rs["sb_id"] . "\">" .$rs["sb_cat_name"]."</a>".$catpath; 
  	$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $rs["sb_pid"] );
	 
	}


?> 
<script language="JavaScript">
function win(box)
{
str="addcontact_popup.php?"  + box;

window.open(str,"Allot","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=350,height=150,location=no,directories=no,scrollbars=yes");
return false;
}

function win1(box)
{
str="addblock_popup.php?"  + box;

window.open(str,"Allot","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=350,height=150,location=no,directories=no,scrollbars=yes");
return false;
}
</script>
<table width="100%" border="0" cellspacing="10" cellpadding="2" class="maintablestyle">
  <tr> 
    <td valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
        <tr> 
          <form name="form1" method="post" action="search.php">
            <td align="center" valign="middle" class="innertablestyle"><br> <input name="keyword" type="text" value="<? echo $keyword;?>" size="40"> 
              &nbsp;&nbsp; <select name="type">
                <option value="1" selected>Sell Offers</option>
                <option value="2">Buy Offers</option>
                <option value="3">Products Catalogs</option>
                <option value="4">Company Profiles</option>
              </select> &nbsp;&nbsp; <input type="submit" name="Submit" value="Search"> 
              &nbsp;<a href="advance_search.php">Advance Search</a> <br> &nbsp; 
            </td>
          </form>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" >
        <tr> 
          <td>
            <!--font class="normal">&nbsp;<a href="index.php">Home</a><? //echo $catpath;?></font-->
          </td>
        </tr>
        <tr> 
          <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="titlestyle">
              <tr> 
                <td width="150" align="center" valign="middle" >&#8595; &nbsp;Product 
                  Catalog</td>
                <td valign="middle"  class="subtitle"><div align="center"><?php echo $sbrow_off["sb_title"]; ?> 
                  </div></td>
                <td class="subtitle"> 
                  <div align="right" ><a href="add_favorites.php?sb_type=3&sb_id=<?php echo $id; ?>">Add 
                    to favorites</a></div></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td valign="top"><table width="90%" border="0" align="center" cellpadding="4" cellspacing="1" class="onepxtable">
        <tr> 
          <td width="40%" height="25" valign="top" class="subtitle"><div align="right">Categories</div></td>
          <td height="25" class="innertablestyle"> 
            <?php 
		  	$sbq_cat="select * from sbbleads_product_cats where sb_offer_id=$id";
			//echo $sbq_cat;
			$sbrs_cat=mysql_query($sbq_cat);
	/*		$sbcat_exists=false;
	*/		while($sbrow_cat=mysql_fetch_array($sbrs_cat))
			{
				$catpath="";
				$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=".$sbrow_cat["sb_cid"] );
/*				if($sbrow_cat["sb_cid"] == $cid)		//working code
//					continue; 		//for skipping the category that is alreday displayed or passed 
*/				while ($rs=mysql_fetch_array($cat_query))
				{
/*					$sbcat_exists=true;		//just checks whether we come in this portion ever 
*/					$catpath =" > <a href=\"cat_products.php?cid=" . $rs["sb_id"] . "\">" .$rs["sb_cat_name"]."</a>".$catpath; 
					$cat_query=mysql_query("Select * from sbbleads_categories where sb_id=" . $rs["sb_pid"] );
	 
				}
				echo '<a href="index.php">Home</a>'.$catpath.'<br>'; 
			}
/*			if(!$sbcat_exists)
				echo $config["sb_null_char"];	//prints in case no other category than cid
*/		  ?>
          </td>
        </tr>
        <tr> 
          <td height="25" valign="top" class="subtitle"><div align="right">Description</div></td>
          <td height="25" class="innertablestyle"><?php echo $sbrow_off["sb_description"]; ?></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Minimum Order</div></td>
          <td height="25" class="innertablestyle" ><font class="normal"><?php echo $sbrow_off["sb_min_order"]; ?></font></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Price </div></td>
          <td height="25" class="innertablestyle" > <font class="normal"> 
            <?php 
		  $sbq_cur="select * from sbbleads_currencies where sbcur_id=".$sbrow_off["sb_price_cur_id"];
		  $sbrow_cur=mysql_fetch_array(mysql_query($sbq_cur));
		  echo $sbrow_cur['sbcur_symbol'].' '.$sbrow_off["sb_price"]; ?>
            </font></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Location</div></td>
          <td height="25" class="innertablestyle" ><font class="normal"><?php echo $sbrow_off["sb_location"]; ?></font></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Posted On</div></td>
          <td height="25" class="innertablestyle" ><font class='normal'><?php echo sb_date($sbrow_off["sbposted"]);?></font></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Posted By</div></td>
          <td height="25" class="innertablestyle" ><strong><font class="normal"> 
            <?php 
		   $mem=mysql_fetch_array(mysql_query("select * from sbbleads_members where sb_id=".$sbrow_off["sb_uid"]));
		  $profile=mysql_fetch_array(mysql_query("select * from sbbleads_companyprofiles where sb_uid=".$sbrow_off["sb_uid"]));
		  if ($profile) 
		   	echo $profile["sb_companyname"]; 
		  else   
		  	echo $mem["sb_username"];
 ?>
            </font><font class="smalltext"><font class="red"><strong>[ 
            <?php  
			$level_query=mysql_query("select * from sbbleads_levels where sb_levelid=" .$mem["sb_memtype"]);
            $level= mysql_fetch_array($level_query);
			echo $level["sb_levelname"];
			?>
            ]</strong></font></font></strong></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Sample Available</div></td>
          <td height="25" class="innertablestyle" ><font class="normal"><?php echo $sbrow_off["sb_samples_available"]; ?></font></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Product Status</div></td>
          <td height="25" class="innertablestyle" ><font class="normal"><?php echo $sbrow_off["sb_product_status"]; ?></font></td>
        </tr>
        <tr> 
          <td height="25" valign="top" class="subtitle"><div align="right">Payment 
              Mode</div></td>
          <td height="25" class="innertablestyle" ><font class="normal"> 
            <?php 
		  	$sb_payment_mode=$sbrow_off["sb_payment_mode"];
			$sb_other_mode=$sbrow_off["sb_other_mode"];
		
	if(strstr($sb_payment_mode,'cash'))
		echo 'Cash<br>';
	if(strstr($sb_payment_mode,'cheque'))
		echo 'Cheque<br>';
	if(strstr($sb_payment_mode,'credit'))
		echo 'Credit Card<br>';
	if(strstr($sb_payment_mode,'bank'))
		echo 'Bank Transfer<br>';
	if(strstr($sb_payment_mode,'loc'))
		echo 'Letter of Credit<br>';
	if(strstr($sb_payment_mode,'escrow'))
		echo 'Escrow<br>';
	echo $sb_other_mode;
//echo $sb_payment_mode;
			  
//		  echo $sbrow_off["sb_description"]; ?>
            </font></td>
        </tr>
        <tr> 
          <td height="25" class="subtitle"><div align="right">Shipping Cost</div></td>
          <td height="25" class="innertablestyle" ><font class="normal"><?php echo $sbrow_cur['sbcur_symbol'].' '.$sbrow_off["sb_shipping_cost"]; ?></font></td>
        </tr>
        <tr>
          <td height="25" class="subtitle">&nbsp;</td>
          <td height="25" class="innertablestyle" > 
            <?php 
		  $sbq_com="select * from sbbleads_companyprofiles where sb_uid=".$sbrow_off["sb_uid"];
		  $sbrow_com=mysql_fetch_array(mysql_query($sbq_com));
		  if($sbrow_com)
		  {
		  ?>
            [<a href="view_profile.php?id=<?php echo $sbrow_com["sb_id"]; ?>">View 
            Company Profile</a>]<br> 
            <?php 
		  }		//end if sbrow_com ?>
            [<a href="contactuser.php?sb_type=3&sb_id=<?php echo $id."&tid=".$sbrow_off["sb_uid"]; ?>">Send A 
            Message</a>][<a href="addtocart.php?sb_type=3&sb_id=<?php echo $id; ?>">Add 
            to Inquiry Basket</a>]<br>
            [<a href="dummy.htm" onClick="return win('<?php echo "sb_type=1&sb_id=$id&username=".$mem["sb_username"]; ?>');"  >Add 
            to Contact List</a>][<a href="dummy.htm" onClick="return win1('<?php echo "sb_type=1&sb_id=$id&username=".$mem["sb_username"]; ?>');">Block 
            List</a>] </td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td class="titlestyle">&nbsp;Relevant Images</td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="5" class="onepxtable">
        <?php 
		$sbq_img="select * from sbbleads_product_images where sb_offer_id=$id";
	//	die($sbq_img);
		$sbrs_img=mysql_query($sbq_img);
		if(mysql_num_rows($sbrs_img)>0)
		{
			$sbcnt=0;
			$sbimg_per_row=4;
			while($sbrow_img=mysql_fetch_array($sbrs_img))
			{
		?>
        <?php if($sbcnt%$sbimg_per_row == 0) 
				{ ?>
        <tr> 
          <?php 
				}	//end if 
				$sbcnt++;
				?>
          <td class="innertablestyle"><div align="center"><a href="uploadedimages/product_images/<?php echo $sbrow_img["sb_img_url"]; ?>" target="_blank"><img src="uploadedimages/product_images/<?php echo $sbrow_img["sb_img_url"]; ?>" border="0" height="100" width="100"></a></div></td>
          <?php if($sbcnt%$sbimg_per_row == 0) 
				{ ?>
        </tr>
        <?php 
				}	//end if 
				?>
        <?php 
			}		//end while 
		}
		else
		{	?>
        <tr> 
          <td><font class="normal">No images have been defined</font></td>
        </tr>
        <?php 
		}		//end else no img defined?>
      </table></td>
  </tr>
</table>
<?
}// end main
include "template.php";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -