Home > Backend Development > PHP Tutorial > An automated personal web page generation system (3)_PHP tutorial

An automated personal web page generation system (3)_PHP tutorial

WBOY
Release: 2016-07-13 17:21:15
Original
984 people have browsed it

网站管理,文件名:guanli.php


Untitled Document

























页面管理




// 程序开始
$db = mysql_connect("localhost", "root");

mysql_select_db("study",$db);
// 判断是不是修改文件
if ($submit) {

$sql = "UPDATE wenzhang SET timu=$timu,zuozhe=$zuozhe,
laiyuan=$laiyuan,textt=$textt WHERE id=$id";



// 向数据库发出SQL命令

$result = mysql_query($sql);
// 文章生成
$t = date("Y-m-d h:i:s");
$muoban1 = fopen("muoban1.txt","r");
$muoban2 = fopen("muoban2.txt","r");
$muoban3 = fopen("muoban3.txt","r");
$qita = "






作者:$zuozhe 来源:$laiyuan
时间:$t

";
$muoban4=fread($muoban1,1000);
$ muoban5=fread($muoban2,1000);
$muoban6=fread($muoban3,1000);
fclose($muoban1);
fclose($muoban2);
fclose($muoban3) ;
$main="$muoban4 $timu $qita $muoban5 $textt $muoban6";
// Article generation
$ttt=".html";
$n=$id.$ ttt;
$f = fopen($n,"w");
fwrite($f,$main);
fclose($f);

echo "Record modified successfully !

";


}

// Are we entering the editing state?
if ($id) {


// We are editing and modifying the status, so select a record

$sql = "SELECT * FROM wenzhang WHERE id=$id";

$result = mysql_query($sql);

$myrow = mysql_fetch_array($result);

$id = $myrow["id"];

$timu = $myrow["timu"];

$zuozhe = $myrow["zuozhe"];

$laiyuan = $myrow["laiyuan"];

$textt = $myrow["textt"];


// Display id for users to edit and modify


$fom1="




















Title: < ;/td>


< ;/td>
Author:

Source:

Text:



";
echo $fom1;
}
if (!$id) {


// If the status is not modified, display the employee list

$result = mysql_query("SELECT * FROM wenzhang",$db);
printf("

    ");
    while ($myrow = mysql_fetch_array($result)) {

    printf("

  • %s n",
    $myrow["id"], $myrow["timu"] );

    printf("(modify)

  • ", $PATH_INFO, $myrow["id" ]);

    }
    printf("

"); }
// End of program
?>







www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532497.htmlTechArticleWebsite management, file name: guanli.php html head titleUntitled Document/title meta http-equiv="Content-Type " content="text/html; charset=gb2312" /head body bgcolor="#FFFFFF" backgrou...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template