当前位置: 移动技术网 > IT编程>开发语言>PHP > phpfans留言版用到的install.php

phpfans留言版用到的install.php

2019年06月08日  | 移动技术网IT编程  | 我要评论

广州学校招聘,盐的作用,散文阅读

复制代码 代码如下:
<?php  
/********************************************* 

* 程序名: php爱好者留言板 
* 演  示: http://www.phpfans.net/guestbook/ 

* 作 者: 我不是鱼 
* email: deng5765@163.com 
* 网 址: http://www.phpfans.net 
* 博 客:  http://www.phpfans.net/space/?2 

* 版本: v1.0 
* 帮助:  http://www.phpfans.net/guestbook/ 
*********************************************/ 
if(isset($_post['submit'])){ 
$mydbuser = $_post['m_root']; 
$mydbpw = $_post['m_pw']; 
$mydbname = $_post['m_db']; 
if(!@mysql_connect("localhost",$mydbuser,$mydbpw)) { 
echo "mysql用户名或密码不正确.返回修改.<br><a href=\"#\" onclick=\"window.history.back();\">返回</a>"; 
exit; 

mysql_query("set names 'gbk'"); 
$dbsql = "create database if not exists ".$mydbname; 
if(!@mysql_query($dbsql)){echo "请检查是否有建数据库的权限";exit;} 
echo "创建数据库{$mydbname}成功>><br>"; 
mysql_select_db($mydbname); 

$char = ''; 
if(mysql_get_server_info()> '4.1') $char = 'default charset=gbk'; 

$sql = "create table `post` ( 
  `p_id` int(255) unsigned not null auto_increment, 
  `p_name` varchar(20) not null, 
  `p_email` varchar(20) not null, 
  `p_qq` varchar(20) not null, 
  `p_homepage` varchar(100) not null, 
  `p_image` varchar(8) not null, 
  `p_title` varchar(160) not null, 
  `p_content` mediumtext not null, 
  `p_ip` varchar(15) not null, 
  `p_date` datetime not null, 
  primary key  (`p_id`) 
) engine=myisam {$char};"; 
if(!@mysql_query($sql)){echo "请检查数据表post是否存在,存在请先删除.";exit;} 
echo "创建数据表 post 成功>><br>"; 

$sql = "insert into `post` values (1, '我不是鱼', 'deng5765@163.com', '245821218', 'http://www.phpfans.net', '01', '感谢你使用php爱好者留言板', ' 
<p>非常感谢你对php爱好者留言板的支持</p> 
<p>在使用中遇到任何问题,请到</p> 
<p><a href=\"http://www.phpfans.net/guestbook/\">http://www.phpfans.net/guestbook/</a> 获得帮助</p> 
<p>或提出你的建议.同时欢迎大家光临php爱好者站</p> 
<p><a href=\"http://www.phpfans.net/\">http://www.phpfans.net</a> <img src=\"http://localhost/guestbook/htmleditor/smile/smile28.gif\"></p>', '127.0.0.1', now())"; 
if(@mysql_query($sql)){echo "初始化数据表成功<br>";} 

$sql = "create table `reply` ( 
  `r_id` int(255) unsigned not null auto_increment, 
  `p_id` int(255) not null, 
  `r_content` varchar(255) not null, 
  `r_rname` varchar(20) not null, 
  `r_time` date not null, 
  primary key  (`r_id`), 
  unique key `p_id` (`p_id`) 
) engine=myisam {$char};"; 
if(!@mysql_query($sql)){echo "请检查数据表reply是否存在,存在请先删除.";exit;} 
echo "创建数据表 reply 成功>><br>"; 

$str = '<?php'."\n"; 
$str .= '$mydbhost = \'localhost\''.";//数据库服务器\n"; 
$str .= '$mydbuser = \''.$mydbuser."';//数据库用户名\n"; 
$str .= '$mydbpw = \''.$mydbpw."';//数据库密码\n"; 
$str .= '$mydbname = \''.$mydbname."';//数据库名\n"; 
$str .= '$mydbcharset = \'gbk\''.";//数据库编码,不建议修改.\n"; 
$str .= '$admin = \''.$_post['m_admin'].'\';//管理员名称'."\n"; 
$str .= '$adminpw = \''.$_post['m_adminpw'].'\';//管理员密码'."\n"; 
$str .= '$eachpage = 5;//每页显示留言条数'."\n"; 
$str .= '?>'; 
$fp = fopen('include/config.php','w'); 
if(!$fp){echo"此空间不支持file函数,请手动配置config.php上的内容<br>";} 
else{ 
fwrite($fp,$str); 
fclose($fp); 
echo "配置文档 config.php 更新成功>><br><br>"; 
echo "安装顺利完成.安全起见,请删除insall.php<br>"; 

echo ' 
<a href="index.php">进入留言板首页</a>'; 
exit; 

?> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="content-type" content="text/html; charset=gbk" /> 
<title>php爱好者 留言板_安装</title> 
<link type="text/css" href="guest.css" rel="stylesheet"> 
</head> 

<body> 
<center> 
<?php require_once('header.html');?> 
<table id="ptable" class="tableboder" cellpadding="0" cellspacing="1"> 
<form id="form1" name="form1" method="post" action=""> 
  <tr> 
    <td colspan="3" class="header">安装 php爱好者留言板</td> 
    </tr> 
  <tr> 
    <td>数据库服务器:</td> 
    <td><input name="m_host" type="text" id="m_host" value="localhost"></td> 
    <td>数据库服务器地址, 一般为 localhost</td> 
  </tr> 
  <tr> 
    <td width="220">数据库用户名:</td> 
    <td width="266"><input name="m_root" type="text" id="m_root" /></td> 
    <td width="280">数据库账号用户名</td> 
  </tr> 
  <tr> 
    <td>数据库密码:</td> 
    <td><input name="m_pw" type="password" id="m_pw" /></td> 
    <td>数据库账号密码</td> 
  </tr> 
  <tr> 
    <td>数据库名:</td> 
    <td><input name="m_db" type="text" id="m_db"></td> 
    <td> 不存在自动创建</td> 
  </tr> 
  <tr> 
    <td>留言板管理员名:</td> 
    <td><input name="m_admin" type="text" id="m_admin"></td> 
    <td> </td> 
  </tr> 
  <tr> 
    <td>留言板管理员密码:</td> 
    <td><input name="m_adminpw" type="text" id="m_adminpw"></td> 
    <td> </td> 
  </tr> 
  <tr> 
    <td colspan="3"><input type="submit" name="submit" value=" 安 装 " />  
        安装后所以配置可以在 include/config.php再作修改</td> 
    </tr> 
</form> 
</table> 

<?php require_once('footer.html');?> 
</center> 
</body> 
</html>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网