|
创建前文件界面
php写出自己的BLOG系统2 style="oldpaddingTop: ; oldborderTopWidth: ; oldpaddingBottom: ; oldborderBottomWidth: ; oldpaddingRight: ; oldborderRightWidth: ; oldpaddingLeft: ; oldborderLeftWidth: " alt="" src="/d/file/itjie/phpjishu/2014-10-22/4c64572a3f019e3a9f92b3d33dfcc84b.jpg" onload=ResizeImage(this,520)>
创建配置文件后界面,会提示不能重复安装
php写出自己的BLOG系统2 style="oldpaddingTop: ; oldborderTopWidth: ; oldpaddingBottom: ; oldborderBottomWidth: ; oldpaddingRight: ; oldborderRightWidth: ; oldpaddingLeft: ; oldborderLeftWidth: " alt="" src="/d/file/itjie/phpjishu/2014-10-22/aa12a9b9359670a80f5b68a269ea1f52.jpg" onload=ResizeImage(this,520)>
下面就上代码吧,html界面的代码就不上了,直接上php代码吧
复制代码 代码如下:
<?php
/*
FILE:install.php
Author:www.5dkx.com
DATE:2010-3-29
DONE:安装配置文件
*/
if($_POST[mysubmit])
{
$host = $_POST[hostname];
$user = $_POST[user];
$passwd = $_POST[passwd];
$dbname = $_POST[dbname];
$siteurl = "http://".$_POST[siteurl];
$sitekeyword = $_POST[sitekeyword];
$sitedescription = $_POST[sitedescription];
$sitename = $_POST[sitename];
if(!file_exists("install_locak.txt"))
{
$fp = fopen("./include/config.func.php","w+");
if(flock($fp,LOCK_EX))
{
fwrite($fp,"<"."?php/r/n");
fwrite($fp,"/$host=/"$host/";/r/n");
fwrite($fp,"/$user=/"$user/";/r/n");
fwrite($fp,"/$passwd=/"$passwd/";/r/n");
fwrite($fp,"/$dbname=/"$dbname/";/r/n");
fwrite($fp,"/$sitename=/"$sitename/";/r/n");
fwrite($fp,"/$siteurl=/"$siteurl/";/r/n");
fwrite($fp,"/$sitekeyword=/"$sitekeyword/";/r/n");
fwrite($fp,"/$sitedescription=/"$sitedescription/";/r/n");
$tmp = "/$conn = mysql_connect(/$host,/$user,/$passwd)or die(mysql_error());/r/n";
fwrite($fp,$tmp);
$tmp ="mysql_query(/"set names 'gbk'/")or die(/"设置字符库失败!/");/r/n";
fwrite($fp,$tmp);
$tmp ="mysql_select_db(/$dbname,/$conn)or die(/"连接数据库失败!/");/r/n";
fwrite($fp,$tmp);
fwrite($fp,"?>/r/n");
flock($fp,LOCK_UN);
echo "文件配置成功!<br>";
echo "<script language=/"Javascript/">window.location.href=/"install2.php/";</script>";
}
else
{
echo "can't lock the file!<br>";
}
fclose($fp);
$fins = fopen("install_lock.txt","w");
fclose($fins);
}
else
{
echo "install_locak.txt已经存在,要想重新安装请删除此文件!<br>";
}
}
?>
php技术:创建配置文件 用PHP写出自己的BLOG系统 2,转载需保留来源!
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。