################################################
此篇文章屬原創,如有引用,請標示作者資訊。
Email: leo_cdp@yeah.net
http://www.cfeng.net/
本文程式碼任意轉載,使用請保留此聲明
########### #####################################
去年寫了個文字管理總覺得有些不爽再加上申請了主機所以寫個PHP MYSQL的對文章進行管理測試期間
受到廣大網友的支持現將代碼公佈
功能說明:
文章的基本操作:添加,修改,鎖定,解鎖,推薦,刪除等待
並有強大功能的搜索,評論,推薦給朋友等功能,並對安全性進行著重加強,漂亮的界面人性化的設計。
主要文件清單:
setup.php 安裝程序,運作後即可使用本系統!
index.php 顯示
manager.php 新增,管理文章。
change.php 對已存在文章的操作。
edit_article.php 文章修改
commend.php 推薦文章給朋友。
read_article.php 文章閱讀。
ping.php 發表文章評論。
search.php 文章搜尋
type_manager.php 類型管理
login.php 管理員登陸。
config.php 主要設定檔
func.php 函數檔
footer.inc,header.inc,nav.inc包含檔案。
list.txt 類型清單
以及其它一些週邊程式
管理系統簡報位址:
http://www.cfeng.net/article/
########################################################################################################################################################################## ################config.php 主要設定檔##########################
$host="localhost"; #資料庫主機
$data ; ##資料庫密碼
$database="cfeng.net"; ##資料庫
$table="cfeng.net"; ##已存放評論的表格
$admin_usn="leo"; ##管理員使用者名稱
$admin_pwd="le 🎜>$admin_mail="leo_cdp@yeah.net"; ##管理員信箱
$pagenum="20"; ##在每頁顯示文章數
$sess=md5($admin_usn.##每頁顯示文章數
$sess=md5($admin_usn.$#於每頁顯示文章數
$sess=md5($admin_usn.$#$$5); ## ################func.php 函數檔################################################################################################# ######
require "./inc/config.php";
function mscon()##資料庫連結
{
global $host,$data_us $database_pwd;
@mysql_connect("$host","$database_usn","$database_pwd") or die("對不起,資料庫連線錯誤!請稍候再來,或與管理員聯絡");
}
function check_login()
{ global $sess;
if(!session_is_registered("sess_0230a09a07cab1df8112d00b1f9a9719") _0230a09a07cab1df8112d00b1f9a9719!=$sess)
{
redir("login.php");
exit;
🎜> {
header("location:$ addr");
}
function add_article()##本系統實行寬進嚴出所以新增文章部份顯得略為簡單!
{
global $database,$table,$title,$cont,$type,$html;
$dat=date(Y年m月d $title);
$query="insert into $table(title,cont,type,time,html) values('$title','$cont','$type','$dat','$ html')";
$res=mysql_db_query("$database",$query);
if(!$res)
echo mysql_error()
} {
global $database,$table;
$query="update $table set hits=hits 1 where id=$id";
$res=mysql_db_query("$database",$"$database",$ query);
}
function add_comm($id)##把本文加為推薦文章
{
global $database,$table;
$query="update $table set comm =1 where id=$id";
$res=mysql_db_query("$database",$query);
}
function un_comm($id)##清除建議!
{
global $database,$table;
$query="update $table set comm='0' where id=$id";
$res=mysql_db_query("$database", $query);
}
function add_lock($id)##鎖定文章
{
global $database,$table;
$query="update $table set locked='1 ' where id=$id";
$res=mysql_db_query("$database",$query);
}
function un_lock($id)##清除鎖定!
{
global $database,$table;
$query="update $table set locked=0 where id=$id";
$res=mysql_db_query("$database",$query );
}
function add_p_num($id)##新增評論次數!
{
global $database,$table;
$query="update $table set p_num=p_num 1 where id=$id";
$res=mysql_db_query("$database",$ query);
}
function add_del($id)##刪除文章!
{
全域$database,$table;
$query="從id='$id' 的$table 移除";
$res=mysql_db_query("$database",$query );
}
#########################setup.php安裝檔案################## ####
session_start();
需要「./inc/func.php」;
check_login();
?
if($sub)
{
$file_cont=" $file_cont.="$host="$host";#你的資料庫伺服器位址n";
$file_cont.="$database_usn="$database_usn";n";
$file_cont.="$database_pwd="$database_pwd";n";
$file_cont.="$database="$database";n";
$file_cont.="$table="$table";n";
$file_cont.="$ping_tab="$ping_tab";n";
$file_cont.="$admin_usn="$admin_usn";n";
$file_cont.="$admin_pwd="$admin_pwd";n";
$file_cont.="$admin_mail="$admin_mail";n";
$file_cont.="$pagenum="$pagenum";n";
$file_cont.="$sess=md5($admin_usn.$admin_pwd);n";
$file_cont.="n";
$file_cont.="?>";
$fp=fopen("./inc/config.php","w");
if(fputs($fp,$file_cont))
echo "設定完成正確偵測各選項的正確性
";
else echo "檔案寫入錯誤,請偵測檔案所在目錄的權限
";
fclose($fp);
echo "正在偵測資料連線......" ;
if(@mysql_connect("$host","$database_usn","$database_pwd"))
{
{
$query="CREATE TABLE $table(
title varchar(55)
時間 varchar(14 ) NOT NULL ,
type varchar(20) NOT NULL,
NULL,
p_num int (2) ULT '0' NOT NULL DEFAULT '0' NOT NULL,
his int(4) DEFAULT '0' NOT NULL,
html int(1) DEFAULT '1' NOT NULL,
主鍵(id),
唯一id (id),
KEY id_2 (id)
if(mysql_db_query($database,$query))
echo"資料庫$表建立成功
".mysql_error();
else
echo"資料庫$表建立失敗
";
$query="建立表格 $ping_tab (
id int(4) NOT NULL auto_increment,
p_id int(4) DEFAULT '0' NOT NULL,
name varchar(50) NOT NULL,
mail varchar(200) NOT NULL,
p_cont text NOT NULL,
time datetime DEFAULT '0000-00 ip varchar(15) NOT NULL,
UNIQUE id (id),
KEY id_2 (id)
if(mysql_db_query($database,$query))
{
>恭喜,文章管理系統安裝成功!請這邊走進行基本設定!
";
$fp=fopen("setup.php","r ");
$file_cont=fread($fp,filesize("setup.php"));
login ();n?>n".$file_cont;
$fp=fopen("setup.php","w");
fclose($fp );
}
else
else
echo "資料庫連線失敗!請偵測你使用者名稱密碼的正確性!
";
exit();
}
require "./inc/header.inc";
?>
require "./inc/nav.inc";?>

ThebestapproachforsendingemailsinPHPisusingthePHPMailerlibraryduetoitsreliability,featurerichness,andeaseofuse.PHPMailersupportsSMTP,providesdetailederrorhandling,allowssendingHTMLandplaintextemails,supportsattachments,andenhancessecurity.Foroptimalu

使用依賴注入(DI)的原因是它促進了代碼的松耦合、可測試性和可維護性。 1)使用構造函數注入依賴,2)避免使用服務定位器,3)利用依賴注入容器管理依賴,4)通過注入依賴提高測試性,5)避免過度注入依賴,6)考慮DI對性能的影響。

phpperformancetuningiscialbecapeitenhancesspeedandeffice,whatevitalforwebapplications.1)cachingwithapcureduccureducesdatabaseloadprovesrovessetimes.2)優化

ThebestpracticesforsendingemailssecurelyinPHPinclude:1)UsingsecureconfigurationswithSMTPandSTARTTLSencryption,2)Validatingandsanitizinginputstopreventinjectionattacks,3)EncryptingsensitivedatawithinemailsusingOpenSSL,4)Properlyhandlingemailheaderstoa

TOOPTIMIZEPHPAPPLICITIONSFORPERSTORANCE,USECACHING,數據庫imization,opcodecaching和SererverConfiguration.1)InlumentCachingWithApcutCutoredSatfetchTimes.2)優化的atabasesbasesebasesebasesbasesbasesbaysbysbyIndexing,BeallancingAndWriteExing

依賴性注射inphpisadesignpatternthatenhancesFlexibility,可檢驗性和ManiaginabilybyByByByByByExternalDependencEctenceScoupling.itallowsforloosecoupling,EasiererTestingThroughMocking,andModularDesign,andModularDesign,butquirscarecarefulscarefullsstructoringDovairing voavoidOverOver-Inje

PHP性能優化可以通過以下步驟實現:1)在腳本頂部使用require_once或include_once減少文件加載次數;2)使用預處理語句和批處理減少數據庫查詢次數;3)配置OPcache進行opcode緩存;4)啟用並配置PHP-FPM優化進程管理;5)使用CDN分發靜態資源;6)使用Xdebug或Blackfire進行代碼性能分析;7)選擇高效的數據結構如數組;8)編寫模塊化代碼以優化執行。

opcodecachingsimplovesphperforvesphpermance bycachingCompiledCode,reducingServerLoadAndResponSetimes.1)itstorescompiledphpcodeinmemory,bypassingparsingparsingparsingandcompiling.2)useopcachebachebachebachebachebachebachebysettingparametersinphametersinphp.ini,likeememeryconmorysmorysmeryplement.33)


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

Dreamweaver Mac版
視覺化網頁開發工具

Dreamweaver CS6
視覺化網頁開發工具

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。