1. 建構開發環境與系統規劃 1-1 Visual Studio Code編輯器完整設定 1-2 各種訊息整理 1-3 test.php 1-4 index.php 1-5 templates/index.tpl 2. 寫入資料到資料庫 2-1 templates/index.tpl 2-2 templates/admin.tpl 2-3 css/my.css 2-4 admin.php 3. 資料庫讀取與程式的整併 3-1 admin.php 3-2 index.php 3-3 function.php 3-4 templtes/index.tpl 4. 加入登入及管理功能 4-1 header.php 4-2 footer.php 4-3 index.php 4-4 admin.php 4-5 templtes/header.tpl 4-6 templtes/footer.tpl 4-7 templtes/index.tpl 4-8 templtes/admin.tpl 4-9 templates/op_show_article.tpl 4-10 templates/op_list_article.tpl 4-11 css/my.css 4-12 signup.php 4-13 templtes/signup.tpl 5. 編輯器及上傳縮圖 5-1 includes/mailsender.php 5-2 config.php 5-3 verifyuser.php 5-4 signup.php 5-5 header.php 5-6 admin.php 5-7 main_login.php 5-8 loginheader.php 5-9 index.php 5-10 css/my.css 5-11 templates/nav.tpl 5-12 templates/admin.tpl 5-13 templates/index.tpl 5-14 templates/signup.tpl 5-15 templates/verifyuser.tpl 5-16 templates/main_login.tpl 5-17 templates/op_article_form.tpl 5-18 ckeditor/config.js 5-19 elFinder/elfinder_cke.php 6. 使用上傳物件及管理功能 6-1 admin.php 6-2 index.php 6-3 templates/nav.tpl 6-4 templates/index.tpl 6-5 templates/admin.tpl 6-6 templates/footer.tpl 6-7 templates/op_article_form.tpl 6-8 templates/op_list_article.tpl 6-9 templates/op_show_article.tpl 6-10 css/my.css 6-11 reporter.sql 7. 多人合作開發 7-1 admin.php 7-2 index.php 7-3 function.php 7-4 templates/op_modify_article.tpl 7-5 templates/op_article_form.tpl 7-6 templates/op_modify_article.tpl 7-7 .gitignore 8. 文章分頁及搜尋 8-1 index.php 8-2 function.php 8-3 PageBar.php 8-4 search.php 8-5 css/my.css 8-6 templates/op_show_article.tpl 8-7 templates/op_list_article.tpl 8-8 templates/nav.tpl 8-9 templates/search.tpl 8-10 templates/op_search_article.tpl 8-11 templates/op_search_form.tpl 9. JOIN資料表及寄信功能 9-1 search.php 9-2 function.php 9-3 admin.php 9-4 templates/op_search_article.tpl 9-5 templates/op_show_article.tpl
7-1
admin.php
require
"loginheader.php"
;
require_once
'header.php'
;
$op
= isset(
$_REQUEST
[
'op'
]) ? filter_var(
$_REQUEST
[
'op'
]) :
''
;
$sn
= isset(
$_REQUEST
[
'sn'
]) ? (int)
$_REQUEST
[
'sn'
] : 0;
header(
"location: index.php?sn={$sn}"
);
header(
"location: index.php"
);
header(
"location: index.php?sn={$sn}"
);
require_once
'footer.php'
;
function
insert_article()
$title
=
$db
->real_escape_string(
$_POST
[
'title'
]);
$content
=
$db
->real_escape_string(
$_POST
[
'content'
]);
$username
=
$db
->real_escape_string(
$_POST
[
'username'
]);
$sql
=
"INSERT INTO `article` (`title`, `content`, `username`, `create_time`, `update_time`) VALUES ('{$title}', '{$content}', '{$username}', NOW(), NOW())"
;
$db
->query(
$sql
)
or
die
(
$db
->error);
function
delete_article(
$sn
)
$sql
=
"DELETE FROM `article` WHERE sn='{$sn}' and username='{$_SESSION['username']}'"
;
$db
->query(
$sql
)
or
die
(
$db
->error);
if
(
file_exists
(
"uploads/cover_{$sn}.png"
)) {
unlink(
"uploads/cover_{$sn}.png"
);
unlink(
"uploads/thumb_{$sn}.png"
);
function
update_article(
$sn
)
$title
=
$db
->real_escape_string(
$_POST
[
'title'
]);
$content
=
$db
->real_escape_string(
$_POST
[
'content'
]);
$username
=
$db
->real_escape_string(
$_POST
[
'username'
]);
$sql
=
"UPDATE `article` SET `title`='{$title}', `content`='{$content}', `update_time`= NOW() WHERE `sn`='{$sn}' and username='{$_SESSION['username']}'"
;
$db
->query(
$sql
)
or
die
(
$db
->error);
require_once
'class.upload.php'
;
$foo
=
new
Upload(
$_FILES
[
'pic'
]);
$foo
->file_new_name_body =
'cover_'
.
$sn
;
$foo
->image_resize = true;
$foo
->image_convert = png;
$foo
->image_ratio_y = true;
$foo
->Process(
'uploads/'
);
$foo
->file_new_name_body =
'thumb_'
.
$sn
;
$foo
->image_resize = true;
$foo
->image_convert = png;
$foo
->image_ratio_y = true;
$foo
->Process(
'uploads/'
);
1. 建構開發環境與系統規劃 1-1 Visual Studio Code編輯器完整設定 1-2 各種訊息整理 1-3 test.php 1-4 index.php 1-5 templates/index.tpl 2. 寫入資料到資料庫 2-1 templates/index.tpl 2-2 templates/admin.tpl 2-3 css/my.css 2-4 admin.php 3. 資料庫讀取與程式的整併 3-1 admin.php 3-2 index.php 3-3 function.php 3-4 templtes/index.tpl 4. 加入登入及管理功能 4-1 header.php 4-2 footer.php 4-3 index.php 4-4 admin.php 4-5 templtes/header.tpl 4-6 templtes/footer.tpl 4-7 templtes/index.tpl 4-8 templtes/admin.tpl 4-9 templates/op_show_article.tpl 4-10 templates/op_list_article.tpl 4-11 css/my.css 4-12 signup.php 4-13 templtes/signup.tpl 5. 編輯器及上傳縮圖 5-1 includes/mailsender.php 5-2 config.php 5-3 verifyuser.php 5-4 signup.php 5-5 header.php 5-6 admin.php 5-7 main_login.php 5-8 loginheader.php 5-9 index.php 5-10 css/my.css 5-11 templates/nav.tpl 5-12 templates/admin.tpl 5-13 templates/index.tpl 5-14 templates/signup.tpl 5-15 templates/verifyuser.tpl 5-16 templates/main_login.tpl 5-17 templates/op_article_form.tpl 5-18 ckeditor/config.js 5-19 elFinder/elfinder_cke.php 6. 使用上傳物件及管理功能 6-1 admin.php 6-2 index.php 6-3 templates/nav.tpl 6-4 templates/index.tpl 6-5 templates/admin.tpl 6-6 templates/footer.tpl 6-7 templates/op_article_form.tpl 6-8 templates/op_list_article.tpl 6-9 templates/op_show_article.tpl 6-10 css/my.css 6-11 reporter.sql 7. 多人合作開發 7-1 admin.php 7-2 index.php 7-3 function.php 7-4 templates/op_modify_article.tpl 7-5 templates/op_article_form.tpl 7-6 templates/op_modify_article.tpl 7-7 .gitignore 8. 文章分頁及搜尋 8-1 index.php 8-2 function.php 8-3 PageBar.php 8-4 search.php 8-5 css/my.css 8-6 templates/op_show_article.tpl 8-7 templates/op_list_article.tpl 8-8 templates/nav.tpl 8-9 templates/search.tpl 8-10 templates/op_search_article.tpl 8-11 templates/op_search_form.tpl 9. JOIN資料表及寄信功能 9-1 search.php 9-2 function.php 9-3 admin.php 9-4 templates/op_search_article.tpl 9-5 templates/op_show_article.tpl