:::

2-4 admin.php

<?php
require_once 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;

$db = new mysqli('localhost', 'root', '12345', 'reporter');
if ($db->connect_error) {
    die('無法連上資料庫:' . $db->connect_error);
}
$db->set_charset("utf8");
if (isset($_POST['op']) and $_POST['op'] == "insert") {
    $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;
    header("location: index.php?sn={$sn}");
    exit;
}

// $smarty->assign('now', date("Y年m月d日 H:i:s"));
$smarty->display('admin.tpl');

 


:::

搜尋

QR Code 區塊

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

書籍目錄

展開 | 闔起

線上使用者

358人線上 (144人在瀏覽線上書籍)

會員: 0

訪客: 358

更多…