www.gusucode.com > 2030网博士成品网站管理系统 PHP网站源码程序 > 2030/dingcan/includes/dingcan.inc.php
<?php DingcanConfig(); //模块参数设置 function DingcanConfig(){ global $msql; $msql->query("select * from {P}_dingcan_config"); while($msql->next_record()){ $variable=$msql->f('variable'); $value=$msql->f('value'); $GLOBALS["DINGCANCONF"][$variable]=$value; } } //调用模板 function LoadEsetTemp($RP,$tpl){ global $strTempNotexists; if(file_exists(ROOTPATH."dingcan/templates/".$tpl)){ $fd=fopen(ROOTPATH."dingcan/templates/".$tpl,r); $p=fread($fd,300000); fclose($fd); $p=str_replace("images/",$RP."dingcan/templates/images/",$p); $p=str_replace("css/",$RP."dingcan/templates/css/",$p); $p=str_replace("{#RP#}",$RP,$p); return $p; }else{ $str=$strTempNotexists."(dingcan/templates/".$tpl.")"; return $str; } } function getMemberPrice($gid,$price){ global $tsql; if(isLogin()){ $membertypeid=$_COOKIE["MEMBERTYPEID"]; //按折扣率自动计算价格 $tsql->query("select `discount` from {P}_dingcan_priceset where `membertypeid`='$membertypeid'"); if($tsql->next_record()){ $discount=$tsql->f('discount'); $price=$price*$discount; return $price; }else{ return $price; } }else{ return $price; } } //对订单中的餐品数量进行判断 function checkCookieNums(){ global $fsql,$strNumsNotice1,$strNumsNotice2,$strNumsNotice3,$strNumsNotice4; $iflimit=$GLOBALS["DINGCANCONF"]["PeiSongLimit"]; //判断是否限量配送 $CARTSTR=$_COOKIE["DINGCANCART"]; $array=explode('#',$CARTSTR); $tnums=sizeof($array)-1; if($tnums<1){ return "kongcart"; }else{ for($t=0;$t<$tnums;$t++){ $fff=explode('|',$array[$t]); $goodstype=$fff[0]; $gid=$fff[1]; $acc=$fff[2]; $fz=$fff[3]; if($goodstype=="diy"){ $tbl="{P}_dingcan_zxcon"; }elseif($goodstype=="tc"){ $tbl="{P}_dingcan_gdcon"; }else{ $tbl="{P}_dingcan_zhcon"; } $fsql->query("select * from $tbl where id='$gid'"); if($fsql->next_record()){ $title=$fsql->f('title'); $sparecopy=$fsql->f('sparecopy'); if($acc<=0){ return $strNumsNotice1.'"'.$title.'"'.$strNumsNotice2; } if($iflimit==1 && $goodstype!="zh"){ if($acc>$sparecopy){ return $strNumsNotice1.'"'.$title.'"'.$strNumsNotice3."(".$sparecopy.")".$strNumsNotice4; } } }else{ return "wrongcart"; } } return "OK"; } } ?>