一个个人网页自动化生成系统-C#,JAVA视频教学,网页设计,网站开发,asp,php,mysql,asp.net| 学知识教程网,
设为首页|收藏学知识 |改版意见收集|智能DIY搜索|加入我们|网站地图
当前在线人数:8770
好教程 易学习 新资讯!
PHP

一个个人网页自动化生成系统

2007-07-03 源自: 网友评论 共有( )条评论! 内容报错
本文章地址:http://dev.xuezhishi.net/website/PHP/2007-07-03/19027.html [将本信息与朋友分享!]

                     

当你希望用本系统创建你的个人主页之前,笔者相信你已经配置好了相关的阿帕奇服务器,MySQL数据库,以及PHP。
接着启动你的MySQL数据库,建立一个名为study的数据库,建立一个名为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
单页递交。文件名: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">标题:</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">来源:</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="复 位">
</td>
</tr>
</table>
</form>
</body>
</html>
单页生成,文件名:shengcheng.PHP
<html>

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

<?PHP

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

MySQL_select_db("study",$db);
// 把文章写入数据库
$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);
// 把计数器加一
$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> 来源:<font color="#306800">$laiyuan</font>
时间:<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">继续递交</a><a href="guanli.PHP">管理文件</a></center>
</body>
</html>

 

http://dev.xuezhishi.net/website/PHP/2007-07-03/19027.html
分页:[1] 2
评论 点击查看
 


加入QQ群:35714363 一起成长
我要加入更多群 我有意见要反映
开发教室

学知识原创教程下载

本类最近更新
阅读排行

其他相关信息