15-42. 论坛系统-PHP编写系统安装引导程序

 Why do we program the installing bootstrap(引导) programming? 

  1. Creating database and tables which will be used in the program
  2. Modifying config.inc.php configuration file
<?php 
header('Content-type:text/html;charset=utf-8');
if(isset($_POST['submit'])){
	if(empty($_POST['db_host'])){
		exit('Database address cannot be empty!<a href="install.php">click to reback</a>');
	}
	if(empty($_POST['db_port'])){
		exit('Database port cannot be empty!<a href="install.php">Click to reback</a>');
	}
	if(empty($_POST['db_user'])){
		exit('Database user name cannot be empty!<a href="install.php">Click to reback</a>');
	}
	if(!isset($_POST['db_pw'])){
		exit('Database password does not exist!<a href="install.php">Click to reback</a>');
	}
	if(empty($_POST['db_database'])){
		exit('Database name cannot be empty!<a href="install.php">Click to reback</a>');
	}
	
	$_POST['manage_name']='admin';
	if(empty($_POST['manage_pw']) || mb_strlen($_POST['manage_pw'])<6){
		exit('Backend admin password cannot be less than 6 digits!<a href="install.php">Click to reback</a>');
	}
	if(empty($_POST['manage_pw_confirm']) || $_POST['manage_pw']!=$_POST['manage_pw_confirm']){
		exit('Password input is inconsistent!<a href="install.php">Click to reback</a>');
	}
}
?>


<body>
	<div id="main">
		<div class="title">欢迎使用 本引导安装程序</div>
		<form method="post">
			<label>数据库地址:<input class="text" type="text" name="db_host" value="localhost" /></label>
			<label>端口:<input class="text" type="text" name="db_port" value="3306" /></label>
			<label>数据库用户名:<input class="text" type="text" name="db_user" /></label>
			<label>数据库密码:<input class="text" type="password" name="db_pw" /></label>
			<label>数据库名称:<input class="text" type="text" name="db_database" /></label>
			<br /><br />
			<label>后台管理员名称:<input class="text" type="text" name="manage_name" readonly="readonly" value="admin" /></label>
			<label>密码:<input class="text" type="password" name="manage_pw" /></label>
			<label>密码确认:<input class="text" type="password" name="manage_pw_confirm" /></label>
			<label><input class="submit" type="submit" name="submit" value="确定安装" /></label>
		</form>
	</div>
</body>

发布了198 篇原创文章 · 获赞 82 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/weixin_38134491/article/details/104078280
42
今日推荐