Example #1
0
 public function updatatype()
 {
     @header("Content-Type:text/html; charset=utf-8");
     $admin = parent::is_login();
     $id = $_GET['id'];
     if (!is_numeric($id)) {
         $this->error("参数非法", "index.php?m=page&a=pagetype");
     }
     $AddType = M("page_type");
     //创建数据库连接
     if ($_POST) {
         include_once "Common/CommClass.php";
         CommClass::DenyOtherSubmit();
         $POST = CommClass::Addslashes($_POST);
         $AddType->TypeName = $POST['TypeName'];
         $AddType->endtime = date("Y-m-d H:i:s");
         $num = $AddType->where('id=' . $id . '')->save();
         if ($num > 0) {
             parent::success("数据已修改", $this->thisurl());
         } else {
             //parent::getnews("");
             $this->error("数据未修改!", $this->thisurl());
         }
     }
     $arr = $AddType->find($id);
     if (!$arr) {
         parent::error("系统无法找到指定数据");
     }
     $this->assign("arr", $arr);
     $this->assign("type", "修改");
     $this->display("Tpl/page/addtype.html");
 }