<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>星光贴吧安装向导 Powered by xgcms.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="images/style.css" rel="stylesheet" type="text/css" />
</head><body>
<div id='content'>
<div id='pageheader'>
	<div id="logo" style="margin-top:10px; margin-left:15px;"><img src="../view/images/logo.png" border="0" alt="星光贴吧" /></div>
	<div id="version" class="rightheader">星光贴吧V3.1正式版</div>
</div>
<div id='innercontent'>
	<h1>星光贴吧正式版安装向导</h1>
	<div>数据库配置信息</div>
    <div class="botBorder">
	<form action="index.php?step=4&type=<?php echo $type;?>" method="post" id="checkdbform">
<input type="hidden" name="FORM_HASH" value="123" />
    <table cellpadding="1" cellspacing="1">
       <tr>
          <td>数据库类型</td>
          <td><input type="radio" name="type" id="type_mysql" value="mysql"<?php echo $type == 'mysql'  ? 'checked="checked"' : '';?> <?php echo !$mysql_support ? 'disabled="disabled" onclick="alert(\'当前环境不支持MySQL\')"' : ''; ?> />MySQL
					<input type="radio" name="type" id="type_pdo" value="pdo"<?php echo $type == 'pdo' ? 'checked="checked"' : '';?> <?php echo !$pdo_support ? 'disabled="disabled" onclick="alert(\'当前环境不支持PDO\')"' : ''; ?> />PDO
					<input type="radio" name="type" id="type_mongodb" value="mongodb"<?php echo $type == 'mongodb' ? 'checked="checked"' : '';?> <?php echo !$mongodb_support ? 'disabled="disabled" onclick="alert(\'当前环境不支持MongoDB\')"' : ''; ?> />MongoDB</td>
       </tr>
       <tr>
          <td>数据库主机</td>
          <td><input type="text" size="24" name="host" value="<?php echo isset($_POST['host']) ? core::gpc('host', 'P') : $master['host'];?>" /><span class="grey"> 端口号格式：127.0.0.1:10123</span></td>
       </tr>
       <tr>
          <td>数据库用户名</td>
          <td><input type="text" size="24" name="user" value="<?php echo isset($_POST['user']) ? core::gpc('user', 'P') : $master['user'];?>" /></td>
       </tr>
       <tr>
          <td>数据库密码</td>
          <td><input type="text" size="24" name="pass" value="<?php echo isset($_POST['pass']) ? core::gpc('pass', 'P') : $master['password'];?>" /></td>
       </tr>
       <tr>
          <td>数据库名</td>
          <td><input type="text" size="24" name="name" value="<?php echo isset($_POST['name']) ? core::gpc('name', 'P') : $master['name'];?>" /></td>
       </tr>
       <tr>
          <td>数据库前缀</td>
          <td><input type="text" size="24" name="tablepre" value="<?php echo isset($_POST['tablepre']) ? core::gpc('tablepre', 'P') : $master['tablepre'];?>" /></td>
       </tr>
       <tr>
         <td>管理员账号</td>
         <td><input type="text" size="24" name="adminuser" id="adminuser" value="admin" maxlength="16" /></td>
       </tr>
       <tr>
         <td>管理员密码</td>
         <td><input type="password" size="24" name="adminpass" id="adminpass" value="" maxlength="16" /></td>
       </tr>
       <tr>
         <td>重复密码</td>
         <td><input type="password" size="24" name="adminpass2" id="adminpass2" value="" maxlength="16" /></td>
       </tr>
       <tr>
          <td></td>
          <td><input type="button" value=" 上一步" class="submit" onclick="history.back();"/>
		<input type="submit" value=" 下一步" name="formsubmit" class="submit" id="formsubmit" /></td>
       </tr>
	   <?php if(core::gpc('FORM_HASH', 'P')) { ?>
       <tr>
       <td></td>
       <td>
		<?php if($error) { ?>
			<div class="error"><?php echo $error;?></div>
		<?php } else {?>
			<script type="text/javascript">setTimeout(function() {window.location='?step=5'}, 100);</script>
		<?php }?>
        </td>
       </tr>
	   <?php }?>
    </table>
	</form>
</div>
</div>
<div class='copyright'>Powered by <a href="http://www.xgcms.com" target="_blank">xgcms.com</a></div>
</div>
<div style="display:none;">
</div>
<script type="text/javascript">
function getid(id) {
	return document.getElementById(id);
}

getid('type_mysql').onclick = function() {
	window.location = 'index.php?step=4&type=mysql';
	//getid('db_div').style.display = '';
};
getid('type_pdo').onclick = function() {
	window.location = 'index.php?step=4&type=pdo';
	//getid('db_div').style.display = '';
};
getid('type_mongodb').onclick = function() {
	window.location = 'index.php?step=4&type=mongodb';
	//getid('db_div').style.display = 'none';
};

getid('formsubmit').onclick = function(e) {
	if(getid('adminuser').value == "") {
		alert('请输入管理员账户！');
		getid('adminuser').focus();
		return false;
	}
	if(getid('adminpass').value == "") {
		alert('请输入管理员密码！');
		getid('adminpass').focus();
		return false;
	}
	if(getid('adminpass').value != getid('adminpass2').value) {
		alert('两次输入的密码不一致');
		getid('adminpass2').focus();
		return false;
	}
	return true;
};
</script>
</body>
</html>