📄 index.php
字号:
<?
include_once "myconnect.php";
include_once "date_time_format.php";
function main()
{
$config=mysql_fetch_array(mysql_query("select * from sbbleads_config"));
$sb_no_of_columns=3;
$sb_feature_count=$config["sb_feature_count"]*$sb_no_of_columns;
$sb_no_of_columns_sell=5;
$sb_feature_count_sell=($config["sb_recent_count"])*$sb_no_of_columns_sell;
if(($config["sb_image_magik"]=="enable"))
{
$img_path="thumbs1/";
$img_pmt="";
}
else
{
$img_path="uploadedimages/";
$img_pmt="width=".$config["sb_th_width"]." height=".$config["sb_th_width"];
}
$cid=0;
$sell_num=mysql_num_rows(mysql_query("select * from sbbleads_offers where sb_approved='yes' and DATE_ADD(sb_postedon,INTERVAL ".$config["sb_expiry_sell"]." MONTH) > NOW() "));
$buy_num=mysql_num_rows(mysql_query("select * from sbbleads_offers_buy where sb_approved='yes' and DATE_ADD(sb_postedon,INTERVAL ".$config["sb_expiry_buy"]." MONTH) > NOW() "));
$product_num=mysql_num_rows(mysql_query("select * from sbbleads_products where sb_approved='yes'"));
$profile_num=mysql_num_rows(mysql_query("select * from sbbleads_companyprofiles where sb_approved='yes'"));
?>
<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" size="40">
<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>
<font class='normal'>
<input name="show_save" type="hidden" id="show_save" value="yes">
</font>
<input type="submit" name="Submit" value="Search">
<a href="advance_search.php">Advance Search</a> <br>
</td>
</form>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" class="onepxtable">
<tr>
<td align="center" valign="middle" ><font class="smalltext"><b>Total</b></font></td>
<td align="center" valign="middle" ><font class="smalltext">Sell Offers-<a href="cat_sell.php"><? echo $sell_num;?></a></font></td>
<td align="center" valign="middle" ><font class="smalltext">Buy Offers-<a href="cat_buy.php"><? echo $buy_num;?></a></font></td>
<td align="center" valign="middle" ><font class="smalltext">Products-<a href="cat_products.php"><? echo $product_num;?></a></font></td>
<td align="center" valign="middle" ><font class="smalltext">Companies-<a href="cat_profiles.php"><? echo $profile_num;?></a></font></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td><font class="normal"><b>Browse Sell Offers</b></font></td>
</tr>
<tr >
<td class="onepxtable"><table width="100%" border="0" cellspacing="1" cellpadding="2" class="innertablestyle">
<?
$cats_sql="select * from sbbleads_categories where sb_pid=$cid ";
if($config["sb_cat_listing"]=="alpha")
{
$cats_sql.=" order by sb_cat_name";
}
else
{
$cats_sql.=" order by sb_order_index";
}
$cats_query=mysql_query($cats_sql);
$cnt=1;
while($cats=mysql_fetch_array($cats_query))
{
$rst_query=mysql_query("Select * from sbbleads_categories where sb_pid=".$cats["sb_id"] );
$clist=$cats["sb_id"];
while ( $rst=mysql_fetch_array($rst_query) )
{
$clist.="," . $rst["sb_id"];
$thislist="-1," . $rst["sb_id"];
while ( $rst=mysql_fetch_array($rst_query) )
{
$clist.="," . $rst["sb_id"];
$thislist.="," . $rst["sb_id"];
//echo $rst["sbcat_id"];
}
$rst_query=mysql_query("Select * from sbbleads_categories where sb_pid in (" . $thislist . ")" );
}
$sbcat_str= " and sb_cid IN (" .$clist . ")" ;
$sbq_off_cat="select * from sbbleads_offer_cats, sbbleads_offers where sb_approved='yes' and DATE_ADD(sb_postedon,INTERVAL ".$config["sb_expiry_sell"]." MONTH) > NOW() and sbbleads_offers.sb_id=sbbleads_offer_cats.sb_offer_id $sbcat_str";
$sboff_count=mysql_num_rows(mysql_query($sbq_off_cat));
/* $sbq_buy_cat="select * from sbbleads_offer_cats_buy, sbbleads_offers_buy where sb_approved='yes' and DATE_ADD(sb_postedon,INTERVAL ".$config["sb_expiry_buy"]." MONTH) > NOW() and sbbleads_offers_buy.sb_id=sbbleads_offer_cats_buy.sb_offer_id $sbcat_str";
$sbbuy_count=mysql_num_rows(mysql_query($sbq_buy_cat));
$sbq_product_cat="select * from sbbleads_product_cats, sbbleads_products where sb_approved='yes' and sbbleads_products.sb_id=sbbleads_product_cats.sb_offer_id $sbcat_str";
$sbproduct_count=mysql_num_rows(mysql_query($sbq_product_cat));
$sbq_profile_cat="select * from sbbleads_profile_cats, sbbleads_companyprofiles where sb_approved='yes' and sbbleads_companyprofiles.sb_id=sbbleads_profile_cats.sb_profile_id $sbcat_str";
$sbprofile_count=mysql_num_rows(mysql_query($sbq_profile_cat));
*/
$sbtotal=$sboff_count;//+$sbbuy_count+$sbproduct_count+$sbprofile_count;
//die();
if($cnt%3==1)
{
?>
<tr>
<td width="20"> </td>
<?
}
?>
<td align="left"><font class='normal'> <a href="cat_sell.php?cid=<? echo $cats["sb_id"];?>">
<? echo $cats["sb_cat_name"]; ?></a>(<? echo $sbtotal; ?>)</font></td>
<?
if($cnt%3==0)
{
?>
</tr>
<?
}
$cnt++;
}
?></table></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><div align="center">
<?
////////------getting gold members
mt_srand((double)microtime()*1000000);
$sbq1_mem="select * from sbbleads_members where sb_memtype=1";
$sbrs1_mem=mysql_query($sbq1_mem);
$sbgold_list="0";
while($sbrow1_mem=mysql_fetch_array($sbrs1_mem))
{
$sbgold_list.=",".$sbrow1_mem["sb_id"];
}
$sbq_off="select *,UNIX_TIMESTAMP(sb_postedon) as sbposted from sbbleads_offers where sb_approved='yes' and sb_uid in ($sbgold_list) and DATE_ADD(sb_postedon,INTERVAL ".$config["sb_expiry_sell"]." MONTH) > NOW() order by sb_id desc";
// echo($sbq_off);
$sbrs_off=mysql_query($sbq_off);
$sbrow_count=mysql_num_rows($sbrs_off);
if( ($sbrow_count > 0) && ($sb_feature_count_sell > 0) )
{
if( ($sbrow_count <= $sb_feature_count_sell) )
{ ///////------no need of random coz records are not enough
?>
<table width="90%" border="0" cellspacing="1" cellpadding="0" class="seperatorstyle">
<tr>
<td colspan="<?php echo $sb_no_of_columns_sell; ?>" class="titlestyle"><strong> Featured
Sell Offers</strong></td>
</tr>
<?php
$sb_td_count=0;
while( $sbrow_off=mysql_fetch_array($sbrs_off) )
{
if($sb_td_count%$sb_no_of_columns_sell == 0)
{?>
<tr>
<?php }
?>
<td width="<?php echo round(100/$sb_no_of_columns_sell);?>%" height="100%">
<table width="100%" height="100%" border="0" cellpadding="5" cellspacing="0" class="innertablestyle">
<tr valign="top" >
<td width="100%" align="center">
<?php
$sbq_img_off="select * from sbbleads_offer_images where sb_offer_id=".$sbrow_off["sb_id"];
$sbrow_img_off=mysql_fetch_array(mysql_query($sbq_img_off));
if($sbrow_img_off)
{?>
<div align="center"><a href="view_offer.php?id=<?php echo $sbrow_off["sb_id"]; ?>"><img src="<? echo $img_path; ?><?php echo $sbrow_img_off["sb_img_url"]; ?>" <? echo $img_pmt; ?> border="0" title="<?php echo $sbrow_off["sb_title"]; ?>"></a>
<?php } //end if
else
{
?>
<a href="view_offer.php?id=<?php echo $sbrow_off["sb_id"]; ?>"><img src="images/nopic.gif" <? echo $img_pmt; ?> border="0" title="<?php echo $sbrow_off["sb_title"]; ?>"></a>
<?php } //end else
?>
</div></td>
</tr>
<tr valign="top">
<td align="center"><a href="view_offer.php?id=<?php echo $sbrow_off["sb_id"]; ?>">
<?php /* if (strlen ($sbrow_off["sb_title"])>15)
{
echo substr($sbrow_off["sb_title"], 0, strrpos( substr($sbrow_off["sb_title"], 0, 15),' ' ));
}
else
{
echo $sbrow_off["sb_title"];
}
/*/echo $sbrow_off['sb_title']; ?>
</a></td>
</tr>
</table></td>
<?php
$sb_td_count++;
if($sb_td_count%$sb_no_of_columns_sell == 0)
{?>
</tr>
<?php }
?>
<?php
} //end while
//////-------padding empty tds
$sb_remainder=$sb_td_count%$sb_no_of_columns_sell;
if($sb_remainder==0)
{
$sb_no_of_pads=0;
}
else
{
$sb_no_of_pads=$sb_no_of_columns_sell-$sb_remainder;
}
for($sb_new_counter=1;$sb_new_counter<=$sb_no_of_pads;$sb_new_counter++)
{
?>
<td width="<?php echo round(100/$sb_no_of_columns_sell);?>%" height="100%">
<table width="100%" height="100%" border="0" cellpadding="5" cellspacing="0">
<tr>
<td class="innertablestyle"> <font class="red"><strong>Default
Ad </strong></font></td>
</tr>
<tr>
<td class="innertablestyle"> <font class="smalltext"> Become a
Gold member and your Offer will appear here. </font></td>
</tr>
</table></td>
<?php
} //end for padding?>
</table>
<?php
} //end if no need of random
else
{ // generate random
/////////////////////////////-------------------------------
$number[0]=-1;
for($i=0;$i<$sb_feature_count_sell;$i++)
{
$unique=0;
while($unique==0)
{
$j=mt_rand(1,$sbrow_count);
for($k=0;$k<count($number);$k++)
{
// echo $j;
if($number[$k]==$j)
break;
}
if($k>(count($number)-1))
{
$unique=1;
}
}
$number[$i]=$j;
}
/* echo "sbtotal_in_rs hi";
for($k=0;$k<count($number);$k++)
{
echo $number[$k]." ";
}
*/ // die();
//////////////////////////---------------------------------
?>
<table width="90%" border="0" cellspacing="1" cellpadding="0" class="seperatorstyle">
<tr>
<td colspan="<?php echo $sb_no_of_columns_sell; ?>" class="titlestyle"><strong> Featured
Sell Offers</strong></td>
</tr>
<?php
$sbcounter=0;
$i=0;
$sb_td_count=0;
while( ($i<$sb_feature_count_sell) ) //&& ($sbcounter >= 0) )
{
// echo "I is $i, ";
if( $sbrow_off=mysql_fetch_array($sbrs_off) )
$sbcounter++;
// else
// $sbcounter=-1;
for($j=0;$j<count($number);$j++)
{
// echo "j=$j,";
if( ($sbcounter == $number[$j]) )
{
// echo $sbcounter;
if($sb_td_count%$sb_no_of_columns_sell == 0)
{ ?>
<tr > <?php } ?>
<td width="<?php echo round(100/$sb_no_of_columns_sell);?>%" height="100%" valign="top">
<table width="100%" height="100%" border="0" cellpadding="5" cellspacing="0" class="innertablestyle">
<tr valign="top" >
<td align="center">
<?php
$sbq_img_off="select * from sbbleads_offer_images where sb_offer_id=".$sbrow_off["sb_id"];
// echo "<br>$sbq_img_off<br>";
$sbrow_img_off=mysql_fetch_array(mysql_query($sbq_img_off));
if($sbrow_img_off)
{?>
<div align="center"><a href="view_offer.php?id=<?php echo $sbrow_off["sb_id"]; ?>"><img src="<? echo $img_path; ?><?php echo $sbrow_img_off["sb_img_url"]; ?>" <? echo $img_pmt; ?> border="0" title="<?php echo $sbrow_off["sb_title"]; ?>"></a>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -