$_COOKIE["zzcmscpid"]){
setcookie("zzcmscpid",$cpid.",".$_COOKIE["zzcmscpid"],time()+3600*24*360);
}else{
setcookie("zzcmscpid",$cpid,time()+3600*24*360);
}
}else{
setcookie("zzcmscpid",$cpid,time()+3600*24*360);
}
$sql="select * from zzcms_main where id='$cpid'";
$rs=query($sql);
$row=fetch_array($rs);
if (!$row){
echo showmsg("不存在相关信息!");
}elseif($row["passed"]==0 && !isset($_COOKIE["admin"])){
showmsg('尚未审核');
}else{
query("update zzcms_main set hit=hit+1 where id='$cpid'");
$editor=$row["editor"];
$cpmc=$row["proname"];
$imgbig=$row["img"];
$img=getsmallimg($row["img"]);
$array_img=getimgincontent(stripfxg($row["sm"],true),2);
//print_r ($array_img);
$img2=isset($array_img[0])?$array_img[0]:'/image/nopic.gif';
$img3=isset($array_img[1])?$array_img[1]:'/image/nopic.gif';
$flv=$row["flv"];
$bigclassid=$row["bigclassid"];
$smallclassid=$row["smallclassid"];
if(strpos($smallclassid,',')!==false){
$smallclassid=explode(",",$smallclassid); //转换成数组
$smallclassid=$smallclassid[0];//只取第一个小类,供显示在station中
}
$smallclassid=str_replace('"',"",$smallclassid);//开启多选后小类两边都加了""
$sendtime=$row["sendtime"];
$hit=$row["hit"];
$title=$row["title"];
$keywords=$row["keywords"];
$description=$row["description"];
$prouse=nl2br($row["prouse"]);
$sm=stripfxg($row["sm"],true);
$yq=stripfxg($row["yq"],false,true);
$zc=stripfxg($row["zc"],false,true);
$province=$row["province"];
$city=$row["city"];
$xiancheng=$row["xiancheng"];
$tz=$row["tz"];
$groupid=$row["groupid"];
$groupid_guest=$row["groupid_guest"];//能查看联系方式的用户组级别
$groupname_guest=get_groupname($groupid_guest);//能查看联系方式的用户组级别
$jifen=$row["jifen"];//查看信息所需积分
$skin=$row["skin"];
$shuxing_value = explode("|||",$row["shuxing_value"]);
$rs=query("select classname,classzm from zzcms_zhaoshangclass where classid='".$bigclassid."'");
$row=fetch_array($rs);
if ($row){
$bigclassname=$row["classname"];
$bigclasszm=$row["classzm"];
}else{
$bigclassname="大类已删除";
$bigclasszm="###";
}
$smallclassname='';
$smallclasszm='###';
if ($smallclassid<>0){
$rs=query("select classname,classzm from zzcms_zhaoshangclass where classid='".$smallclassid."'");
$row=fetch_array($rs);
if ($row){
$smallclassname=$row["classname"];
$smallclasszm=$row["classzm"];
}
}
$sql="select * from zzcms_user where username='".$editor."'";
$rs=query($sql);
$row=fetch_array($rs);
$startdate=$row["startdate"];
$comane=$row["comane"];
$gsjj=stripfxg($row["content"],true,true);
$kind=$row["bigclassid"];
$province_company=$row["province"];
$city_company=$row["city"];
$xiancheng_company=$row["xiancheng"];
$somane=$row["somane"];
$userid=$row["id"];
$sex=$row["sex"];
$tel=$row["phone"];//项目单页中有用,避免被下面产品留言中的$phone覆盖这里另取名$tel
$fox=$row["fox"];
$mobile=$row["mobile"];
$qq=$row["qq"];
$email=$row["email"];
function Payjf(){
global $jifen,$editor,$cpid,$startdate,$comane,$kind,$editor,$userid,$groupid,$somane,$sex,$tel,$qq,$email,$mobile,$fox;
$looked=0;
$str="";
$sql="select groupid,totleRMB from zzcms_user where username='".$_COOKIE["UserName"]."'";
$rs=query($sql);
$row=fetch_array($rs);
$totleRMB=$row["totleRMB"];
if (!isset($_POST["action"]) && $looked==0){
$str="
";
$str=$str."";
$str=$str."
";
}elseif ($_POST["action"]=="kan" && $looked==0) {
if( $totleRMB>=$jifen) {
query("update zzcms_user set totleRMB=totleRMB-".$jifen." where username='".$_COOKIE["UserName"]."'");//查看时扣除积分
query("update zzcms_user set totleRMB=totleRMB+".$jifen." where username='".$editor."'");//给发布者加积分
query("insert into zzcms_pay (username,dowhat,RMB,mark,sendtime) values('".$_COOKIE['UserName']."','查看招商信息','-".$jifen."','$cpid','".date('Y-m-d H:i:s')."')");//写入冲值记录
query("insert into zzcms_pay (username,dowhat,RMB,mark,sendtime) values('".$editor."','招商信息售出','+".$jifen."','$cpid','".date('Y-m-d H:i:s')."')");//写入冲值记录
$str=$str.showcontact("zhaoshang",$cpid,$startdate,$comane,$kind,$editor,$userid,$groupid,$somane,$sex,$tel,$qq,$email,$mobile,$fox);//显示公司联系方式,注意这里有用checkid
}else{
$str=$str."您的帐户中已不足 ".$jifen." 金币,暂不能查看!
";
$str=$str."
";
}
}
return $str;
}
$msg="[".$groupname_guest."]才能查看
";
$msg1="需要办理[".$groupname_guest."] 请联系本站客服";
$msg2="如果您是[".$groupname_guest."]请 登录;";
$msg2=$msg2."尚未注册的[".$groupname_guest."]请先 注册 成为本站会员。然后联系客服为您办理为[".$groupname_guest."]。方可查看本页内容。";
if ($groupid_guest==0){//全部用户,即不用登录的未注册用户也可以
$contact=showcontact("zhaoshang",$cpid,$startdate,$comane,$kind,$editor,$userid,$groupid,$somane,$sex,$tel,$qq,$email,$mobile,$fox);//显示公司联系方式,注意这里有用checkid
}else{
if (!isset($_COOKIE["UserName"]) || $_COOKIE["UserName"]=="") {
$contact="";
$contact=$contact.$msg.$msg2;
$contact=$contact."
";
}else{
$sqln="select groupid from zzcms_user where username='".$_COOKIE["UserName"]."'";
$rsn=query($sqln);
$rown=fetch_array($rsn);
$groupid_user=$rown["groupid"];
if ($groupid_user>=$groupid_guest){
//$contact=showcontact("zhaoshang",$cpid,$startdate,$comane,$kind,$editor,$userid,$groupid,$somane,$sex,$tel,$qq,$email,$mobile,$fox);//显示公司联系方式,注意这里有用checkid
$contact=Payjf();
}elseif($groupid_user<$groupid_guest){
//if (jifen=="Yes"){
//if($jifen==0){//当用户设定为不让用积分查看时
//$contact="".$msg.$msg1."
";
//}else{
//$contact=Payjf();
//}
//}elseif (jifen=="No"){
$contact="".$msg.$msg1."
";
//}
}
}
}
function liuyannum($cpid){
$rsdl=query("select id from zzcms_daili where cpid=$cpid and passed=1");
$rowdl=num_rows($rsdl);
if ($rowdl){
return "".$rowdl."";
}else{
return "0";
}
}
function showflv($flv){
global $img1;
if ($flv!=""){
$str="";
if (substr($flv,-3)=="flv") {
$str=$str . "";
$str=$str . "";
$str=$str . "";
}elseif (substr($flv,-3)=="swf"){
$str=$str . "";
}
$str=$str . "
" ;
return $str;
}
}
if ($skin=='cp'){
$fp="../template/".$siteskin."/zhaoshang_show.htm";
}elseif ($skin=='xm'){
$fp="../template/".$siteskin."/zhaoshang_show2.htm";
}else{
$fp="../template/".$siteskin."/zhaoshang_show.htm";
}
if (file_exists($fp)==false){WriteErrMsg($fp.'模板文件不存在');exit;}
$f = fopen($fp,'r');
$strout = fread($f,filesize($fp));
fclose($f);
/*
$fp="../web/".$editor."/".$id."/index.htm";
if (file_exists($fp)==false){WriteErrMsg($fp.'目录不存在');exit;}
$f = fopen($fp,'r');
$sm = fread($f,filesize($fp));
fclose($f);
*/
//liuyan
$liuyan=strbetween($strout,"{liuyan}","{/liuyan}");
$list=strbetween($liuyan,"{loop}","{/loop}");
$rs=query("select * from zzcms_daili where cpid=$cpid and passed=1 order by id desc");
$row=num_rows($rs);
if ($row){
$list2='';
while ($row=fetch_array($rs)){
$list2 = $list2. str_replace("{#content}",cutstr($row["content"],8),$list) ;
$list2 =str_replace("{#dlsname}",$row["dlsname"],$list2) ;
$list2 =str_replace("{#tel}",str_replace(substr($row['tel'],3,4),"****",$row['tel']),$list2) ;
$list2 =str_replace("{#city}",$row['city'],$list2) ;
$list2 =str_replace("{#sendtime}",$row['sendtime'],$list2) ;
}
$strout=str_replace("{loop}".$list."{/loop}",$list2,$strout) ;
$strout=str_replace("{liuyan}","",$strout) ;
$strout=str_replace("{/liuyan}","",$strout) ;
}else{
$strout=str_replace("{liuyan}".$liuyan."{/liuyan}","暂无信息",$strout) ;
}
//licence
$licence=strbetween($strout,"{licence}","{/licence}");
$rs=query("select img,title,passed,editor from zzcms_licence where editor='" .$editor. "' and passed=1");
$row=num_rows($rs);
if ($row){
$n=0;
$licence2='';
while ($row=fetch_array($rs)){
$licence2 = $licence2. str_replace("{#img}",getsmallimg($row['img']),$licence) ;
$licence2 =str_replace("{#imgbig}",siteurl.$row['img'],$licence2) ;
$licence2 =str_replace("{#link}",siteurl.$row['img'],$licence2) ;
$licence2 =str_replace("{#title}",cutstr($row["title"],6),$licence2) ;
$n=$n+1;
($n % 6==0)?$tr="":$tr="";
$licence2 =str_replace("{tr}",$tr,$licence2) ;
}
$strout=str_replace("{licence}".$licence."{/licence}",$licence2,$strout) ;
}else{
$strout=str_replace("{licence}".$licence."{/licence}","暂无信息",$strout) ;
}
//代理表单
$strout=str_replace("{textarea}","",$strout);
$strout=str_replace("{#proname}",str_replace(',','',$cpmc),$strout);
$strout=str_replace("{#cpid}",$cpid,$strout);
$strout=str_replace("{#fbr}",$editor,$strout);
$strout=str_replace("{#bigclassid}",$bigclassid,$strout);
$strout=str_replace("{#token}",$token,$strout);
$companyname="";
$somane=$rown="";
$phone=$rown="";
$email=$rown="";
if (isset($_COOKIE["UserName"])) {
if (trim($_COOKIE["UserName"])!=$editor){//产品发布人登录时不显示自己的联系方式在表单
$rsn=query("select comane,somane,phone,email from zzcms_user where username='".nostr(trim($_COOKIE["UserName"]))."'");
$rown=fetch_array($rsn);
$companyname=$rown["comane"];
$somane=$rown["somane"];
$phone=$rown["phone"];
$email=$rown["email"];
}
}
$strout=str_replace("{#companyname}",$companyname,$strout) ;
$strout=str_replace("{#somane}",$somane,$strout) ;
$strout=str_replace("{#phone}",$phone,$strout);
$strout=str_replace("{#email}",$email,$strout);
//end
//访客地理位置
$cuestip=getip();
//$cuest_city=getIPLoc_sina($cuestip);
//$cuest_city=str_replace('联通','',str_replace('网通','',str_replace('电信','',$cuest_city)));
$strout=str_replace("{#siteskin}",$siteskin,$strout) ;
$strout=str_replace("{#sitename}",sitename,$strout) ;
$strout=str_replace("{#siteurl}",siteurl,$strout) ;
//$strout=str_replace("{#station}",getstation($bigclasszm,$bigclassname,$smallclasszm,$smallclassname,$cpmc,"","zhaoshang"),$strout) ;
$strout=str_replace("{#station}",getstation($bigclasszm,$bigclassname,$smallclasszm,$smallclassname,"","","zhaoshang"),$strout) ;//把产品名设为空,导航里不再显示产品名
if ($title<>"") {
$strout=str_replace("{#pagetitle}",$title.zsshowtitle,$strout);
}else{
$strout=str_replace("{#pagetitle}",$cpmc,$strout);
}
$strout=str_replace("{#pagekeywords}",$keywords.zsshowkeyword,$strout);
$strout=str_replace("{#pagedescription}",$description.zsshowdescription,$strout);
$strout=str_replace("{#img}",$img,$strout);
$strout=str_replace("{#img2}",$img2,$strout);
$strout=str_replace("{#img3}",$img3,$strout);
$strout=str_replace("{#imgbig}",$imgbig,$strout);
$strout=str_replace("{#proname}",$cpmc,$strout);
$strout=str_replace("{#cpid}",$cpid,$strout);
$strout=str_replace("{#prouse}",$prouse,$strout);
$strout=str_replace("{#comane}",$comane,$strout);
$strout=str_replace("{#gsjj}",$gsjj,$strout);
$strout=str_replace("{#sendtime}",$sendtime,$strout);
$strout=str_replace("{#hit}",$hit,$strout);
$strout=str_replace("{#dl_num}",liuyannum($cpid),$strout);
$strout=str_replace("{#flv}",showflv($flv),$strout);
$strout=str_replace("{#bigclassname}",$bigclassname,$strout);
$strout=str_replace("{#smallclassname}",$smallclassname,$strout);
//$strout=str_replace("{#cuest_city}",$cuest_city,$strout);
$strout=str_replace("{#cuest_city}",'',$strout);
$strout=str_replace("{#province_company}",$province_company,$strout);
$strout=str_replace("{#city_company}",$city_company,$strout);
$strout=str_replace("{#xiancheng_company}",$xiancheng_company,$strout);
$strout=str_replace("{#province}",$province,$strout);
$strout=str_replace("{#city}",$city,$strout);
$strout=str_replace("{#xiancheng}",$xiancheng,$strout);
$strout=str_replace("{#tz}",$tz,$strout);
$strout=str_replace("{#sm}",$sm,$strout);
$strout=str_replace("{#zc}",$zc,$strout);
$strout=str_replace("{#yq}",$yq,$strout);
$strout=str_replace("{#contact}",$contact,$strout);
$strout=str_replace("{#editor}",$editor,$strout);
$strout=str_replace("{#tel}",$tel,$strout);
$strout=str_replace("{#mobile}",$mobile,$strout);
$strout=str_replace("{#kfqq}",kfqq,$strout);
if (count($shuxing_value)<3){
for ($a=0; $a< 6;$a++){
$strout=str_replace("{#shuxing".$a."}",'',$strout);
}
}else{
for ($i=0; $i< count($shuxing_value);$i++){
$strout=str_replace("{#shuxing".$i."}",$shuxing_value[$i],$strout);
}
}
$strout=str_replace("{#pageurl}","http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],$strout);
$strout=str_replace("{#sitebottom}",sitebottom(),$strout);
$strout=str_replace("{#sitetop}",sitetop(),$strout);
//if (strpos($strout,"{@")!==false) $strout=showlabel($strout);//先查一下,如是要没有的就不用再调用showlabel
$strout=showlabel($strout);
echo $strout;
}
?>