showmessage.php
上传用户:yttaitong
上传日期:2009-05-10
资源大小:128k
文件大小:3k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

PHP

  1. <?php
  2. /*
  3.     [BBWPS!] (C)2006-2010 小蜜蜂版权所有.
  4. This is NOT a freeware, use is subject to license terms
  5.     时间:2007年12月
  6.     描述:查看信息
  7. */
  8. error_reporting(0);
  9. $mid = $_GET['mid'];
  10. require("../../config.php");
  11. require("../../class/mysql_class.php");
  12. require("../../class/template_class.php");
  13. require_once("../../function/checkModuleSession.php");
  14. $bbwps_admin=isLogin("../../$sessionPath/");
  15. $db= new DB($hostname,$username,$password,$database);
  16. $p=new template("template");
  17. $sql = $db->query("select ".$prefix."message.title,".$prefix."message.cid,".$prefix."message.sid,content,picture,oprice,nprice,btime,etime,cname,sname from ".$prefix."message left join ".$prefix."city 
  18.        on ".$prefix."message.cid=".$prefix."city.cid left join ".$prefix."sort on ".$prefix."message.sid=".$prefix."sort.sid where mid ='".$mid."'",1);
  19. $result=$db->fetch_array($sql);
  20. $content = str_replace("<br />","n",$result["content"]);
  21. $i = floor(($result["etime"]-$result["btime"])/(3600*24));
  22. $p->set_var(array("mid"=> $mid,"title_value"=> $result["title"]));                                  //传参和标题
  23. $sql1=$db->query("select cid,cname from ".$prefix."city where clevel='0'",1);     //城市
  24. $p->set_file("handle","showmessage.html");
  25. $p->set_block("handle","op","a");
  26. $p->set_block("op","ap","b");
  27. while($row1=$db->fetch_array($sql1)){                        //一级城市
  28.   $p->set_var(array("b"=> "","value1"=> $row1["cid"],"name1"=> "|-".$row1["cname"]));
  29.   if($result["cid"]==$row1["cid"])
  30.     $p->set_var("selected1",selected);
  31.   else
  32.     $p->set_var("selected1","");
  33.   $result1=$db->query("select cid,cname from ".$prefix."city where cparent='".$row1["cid"]."'",1);
  34.   while($row2=$db->fetch_array($result1)){                  //二级城市
  35.     $p->set_var(array("value2"=> $row2["cid"],"name2"=> "&nbsp"."&nbsp"."|-".$row2["cname"]));
  36.     if($result["cid"]==$row2["cid"])
  37.      $p->set_var("selected2",selected);
  38.     else
  39.       $p->set_var("selected2","");
  40.     $p->parse("b","ap",true);
  41.   }
  42.   $p->parse("a","op",true);
  43. }
  44. $result2=$db->query("select sname,sid from ".$prefix."sort where slevel = '0'",1);   //分类
  45. $p->set_block("handle","ep","c");
  46. $p->set_block("ep","bp","d");
  47. while($cel1=$db->fetch_array($result2)){                     //一级分类
  48.   $p->set_var(array("d"=> "","value3"=> $cel1["sid"],"name3"=> "|-".$cel1["sname"]));
  49.   if($result["sid"]==$cel1["sid"])
  50.       $p->set_var("selected3",selected);
  51.     else
  52.       $p->set_var("selected3","");
  53.   $sql2=$db->query("select sname,sid from ".$prefix."sort where sparent = '".$cel1["sid"]."'",1);
  54.   while($cel2=mysql_fetch_array($sql2)){                       //二级分类
  55.    $p->set_var(array("value4"=> $cel2["sid"],"name4"=> "&nbsp"."&nbsp"."|-".$cel2["sname"]));
  56.     if($result["sid"]==$cel2["sid"])
  57.       $p->set_var("selected4",selected);
  58.     else
  59.       $p->set_var("selected4","");
  60.     $p->parse("d","bp",true);
  61.   }
  62.   $p->parse("c","ep",true);
  63. }
  64. $p->set_block("handle","mp","e");
  65. if($result["picture"]){                 //信息图片
  66. $handle = explode(".",$result["picture"]);
  67.   $file = date("Y-m-j",$handle[0]);
  68.   $p->set_var(array("file"=> $file,"picture"=> $result["picture"]));
  69.   $p->parse("e","mp",true);
  70. }
  71. $p->set_var(array("oprice"=> $result["oprice"],"nprice"=> $result["nprice"],"btime"=> date("Y-m-j",$result["btime"]),"day"=> $i,"cont_value"=> $content));
  72. $p->parse("showmessage","handle");
  73. $p->p("showmessage");
  74. $db->close();
  75. ?>