:::

4-4 /post.php

<?php
/*-----------引入檔案區--------------*/
include_once "header.php";
$xoopsOption['template_main'] = set_bootstrap("tad_ebook_post.html");
include_once XOOPS_ROOT_PATH."/header.php";

/*-----------function區--------------*/

//編輯表單
function edit_form(){
  global $xoopsTpl , $xoopsUser;

  if($xoopsUser){
    $uid=$xoopsUser->uid();
    $main="使用者編號:{$uid}";
    $page_content="";

    if(!file_exists(XOOPS_ROOT_PATH."/modules/tadtools/ck.php")){
      redirect_header("http://www.tad0616.net/modules/tad_uploader/index.php?of_cat_sn=50",3, _TAD_NEED_TADTOOLS);
    }
    include_once XOOPS_ROOT_PATH."/modules/tadtools/ck.php";
    $fck=new CKEditor("tad_ebook","page_content",$page_content);
    $fck->setHeight(350);
    $editor=$fck->render();

    $xoopsTpl->assign('editor' , $editor);

  }else{
    $main="請先登入!";
  }

  $xoopsTpl->assign('content' , $main);
}


//儲存文章
function insert_page(){
  global $xoopsDB,$xoopsUser;
  /*
    //安全判斷
    if(!$GLOBALS['xoopsSecurity']->check()){
      //錯誤訊息
      $error=implode("<br />" , $GLOBALS['xoopsSecurity']->getErrors());
      //轉向到首頁
      redirect_header($_SERVER['PHP_SELF'],3, $error);
    }
  */
  $myts =& MyTextSanitizer::getInstance();
  $page_title=$myts->addSlashes($_POST['page_title']);
  $page_content=$myts->addSlashes($_POST['page_content']);
  $page_tag=$myts->addSlashes($_POST['page_tag']);

  $ebook_sn=1;

  $page_author=$xoopsUser->name();
  if(empty($page_author)){
    $page_author=$xoopsUser->uname();
  }
  $uid=$xoopsUser->uid();
  $page_post_time=date("Y-m-d H:i:s");

  $tbl=$xoopsDB->prefix('tad_ebook_page');

  $sql="insert into `{$tbl}` (`ebook_sn`,`page_title`,`page_content`,`page_author`,`uid`,`page_sort`,`page_status`,`page_post_time`,`page_counter`,`page_tag`) values('{$ebook_sn}' , '{$page_title}' ,'{$page_content}' ,'{$page_author}' ,'{$uid}' ,'0' ,'0' , '{$page_post_time}' ,'0' ,'{$page_tag}')";

  $xoopsDB->queryF($sql) or die(mysql_error());

}

/*-----------執行動作判斷區----------*/
$op=empty($_REQUEST['op'])?"":$_REQUEST['op'];

switch($op){

  case "insert_page":
    insert_page();
    header("location:{$_SERVER['PHP_SELF']}");
    exit;
  break;


  default:
    edit_form();
  break;
}

/*-----------秀出結果區--------------*/
$xoopsTpl->assign( "toolbar" , toolbar_bootstrap($interface_menu)) ;
include_once XOOPS_ROOT_PATH.'/footer.php';
?>

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Fmail.tad0616.cp22.secserverpros.com%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1136%26tbsn%3D37

書籍目錄

展開 | 闔起

線上使用者

536人線上 (112人在瀏覽線上書籍)

會員: 0

訪客: 536

更多…