明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線(xiàn)學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

一個(gè)個(gè)人頁(yè)面自動(dòng)化生成系統(tǒng)(1)

[摘要]當(dāng)你希望用本系統(tǒng)創(chuàng)建你的個(gè)人主頁(yè)之前,筆者相信你已經(jīng)配置好了相關(guān)的阿帕奇服務(wù)器,MYSQL數(shù)據(jù)庫(kù),以及php。 接著啟動(dòng)你的mysql數(shù)據(jù)庫(kù),建立一個(gè)名為study的數(shù)據(jù)庫(kù),建立一個(gè)名為wenzha...
當(dāng)你希望用本系統(tǒng)創(chuàng)建你的個(gè)人主頁(yè)之前,筆者相信你已經(jīng)配置好了相關(guān)的阿帕奇服務(wù)器,MYSQL數(shù)據(jù)庫(kù),以及php。
接著啟動(dòng)你的mysql數(shù)據(jù)庫(kù),建立一個(gè)名為study的數(shù)據(jù)庫(kù),建立一個(gè)名為wenzhang的表。
在phpMyAdmin下建立如下字段:

id smallint(5) No 0 auto_increment
timu varchar(200) Yes
zuozhe varchar(18) Yes
laiyuan varchar(40) Yes
textt text Yes
riqi datetime Yes
單頁(yè)遞交。文件名:input.php
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" background="image/b-graingr1.jpg">
<form method="post" action="shengcheng.php">
<table width="750" border="1" align="center">
<tr>
<td width="53">標(biāo)題:</td>
<td colspan="3">
<input type="text" name="timu" size="50">
</td>
</tr>
<tr>
<td width="53" height="28">作者:</td>
<td width="154" height="28">
<input type="text" name="zuozhe" size="20">
</td>
<td width="59" height="28">來(lái)源:</td>
<td width="456" height="28">
<input type="text" name="laiyuan" size="30">
</td>
</tr>
<tr>
<td width="53">正文:</td>
<td colspan="3">
<textarea name="textt" cols="90" rows="20"></textarea>
</td>
</tr>
<tr>
<td width="53"> </td>
<td colspan="3">
<input type="submit" name="Submit" value="遞 交">
<input type="reset" name="Submit2" value="復(fù) 位">
</td>
</tr>
</table>
</form>
</body>
</html>
單頁(yè)生成,文件名:shengcheng.php
<html>

<body background="image/b-graingr1.jpg">

<?php

$db = mysql_connect("localhost", "root");

mysql_select_db("study",$db);
// 把文章寫(xiě)入數(shù)據(jù)庫(kù)
$t = date("Y-m-d h:i:s");
$sql = "INSERT INTO wenzhang (timu,zuozhe,laiyuan,textt,riqi)
VALUES ('$timu','$zuozhe','$laiyuan','$textt','$t')";
$result = mysql_query($sql);
// 把計(jì)數(shù)器加一
$fdd=fopen("count.txt","r");
$cdd=fread($fdd,5);
$cdd++;
fclose($fdd);
$fdd=fopen("count.txt","w");
fwrite($fdd,$cdd);
fclose($fdd);
// 文章生成
$muoban1 = fopen("muoban1.txt","r");
$muoban2 = fopen("muoban2.txt","r");
$muoban3 = fopen("muoban3.txt","r");
$qita = "<p><table width="75%" border="0" align="center">
<tr>
<td class=p9>
<div align="center">作者:<font color="#306800">$zuozhe</font> 來(lái)源:<font color="#306800">$laiyuan</font>
時(shí)間:<font color="#336600">$t</font> </div>
</td>
</tr>
</table></p>";
$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=$cdd.$ttt;
$f = fopen($n,"a");
fwrite($f,$main);
fclose($f);
print "<center><b>遞交成功<br>";

?>
<p><br></p>
<p><br></p>
<center><a href="input.php">繼續(xù)遞交</a><a href="guanli.php">管理文件</a></center>
</body>
</html>


 (待續(xù))