:::

5-6 admin.php

<?php
require "loginheader.php";
require_once 'header.php';
$page_title = '管理頁面';

$op = isset($_REQUEST['op']) ? filter_var($_REQUEST['op']) : '';
switch ($op) {
    case 'insert':
        $sn = insert_article();
        header("location: index.php?sn={$sn}");
        break;

    case "article_form":
        break;

    default:
        $op = "";
        break;
}

require_once 'footer.php';

/*************函數區**************/

//儲存文章
function insert_article()
{
    global $db;
    $title   = $db->real_escape_string($_POST['title']);
    $content = $db->real_escape_string($_POST['content']);
    $sql     = "INSERT INTO `article` (`title`, `content`, `create_time`, `update_time`) VALUES ('{$title}', '{$content}', NOW(), NOW())";
    $db->query($sql) or die($db->error);
    $sn = $db->insert_id;
    return $sn;
}

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1378%26tbsn%3D43

書籍目錄

展開 | 闔起

線上使用者

72人線上 (12人在瀏覽線上書籍)

會員: 0

訪客: 72

更多…