一個個人網頁自動化產生系統(3)_PHP教程

來源:互聯網
上載者:User
網站管理,檔案名稱: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";
// 文章產生
$ttt=".html";
$n=$id.$ttt;
$f = fopen($n,"w");
fwrite($f,$main);
fclose($f);

echo "記錄修改成功!

";


}

// 我們是否進入編輯修改狀態
if ($id) {


// 我們是在編輯修改狀態,因些選擇一條記錄

$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"];


// 顯示id,供使用者編輯修改


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


// 如果不是修改狀態,則顯示員工列表

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

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

    printf("

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

    printf("(修改)

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

    }
    printf("

"); }
// 程式結束
?>







http://www.bkjia.com/PHPjc/532497.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/532497.htmlTechArticle網站管理,檔案名稱:guanli.php html head titleUntitled Document/title meta http-equiv="Content-Type" content="text/html; charset=gb2312" /head body bgcolor="#FFFFFF" backgrou...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.