step_3.php
6.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<script type='text/javascript' src='images/jquery.min.js'></script>
<div class="box">
<form action='index.php?action=installSql' method='post' target="install_iframe" onsubmit="return check_form();">
<div>
<div class="red_box" style='display:none' id='error_div'>
<img src="images/error.gif" width="16" height="15" /><span id="error_info"></span>
</div>
<div class="gray_box">
<div class="in_box">
<table class="default">
<colgroup><col width="100px">
<col>
</colgroup><tbody><tr>
<th>数据库地址</th><td><input class="gray" type="text" name="db_address" value="127.0.0.1:3306"> <label>MYSQL数据库的地址,本地默认:127.0.0.1:3306</label></td>
</tr>
<tr>
<th>数据库名称</th><td><input class="gray" type="text" name="db_name"> <label class="fail" id="db_name_label" style="padding-left:24px;display:none">请填写正确的数据库名称</label></td>
</tr>
<tr>
<th>账户</th><td><input class="gray" type="text" value="root" name="db_user">
<label class="fail" style="display:none">账号不能为空</label></td>
</tr>
<tr>
<th>密码</th><td><input class="gray" type="password" name="db_pwd"></td>
</tr>
<tr>
<th>数据库表前缀</th>
<td><input class="gray" type="text" value="tiny_" name="db_pre"> <label class="fail" style="display:none">数据库表前缀不能为空!</label></td>
</tr>
<tr>
<th></th><td><input class="button" value="检测连接" type="button" onclick="check_connect();"></td>
</tr>
</tbody></table>
<p id="connect_status" style="display:none">数据库连接正确</p>
<hr>
<table class="default">
<colgroup><col width="100px">
<col>
</colgroup><tbody><tr>
<th>管理员账户</th>
<td>
<input class="gray" type="text" name="admin_user" value="admin"><label class="fail" style="display:none">管理里员账号必需为4-20位有效字符</label>
</td>
</tr>
<tr>
<th>密码</th>
<td>
<input class="gray" type="password" name="admin_pwd"><label class="fail" style="display:none">密码格式不正确,字符在6-20位之间</label>
</td>
</tr>
<tr>
<th>再次确认</th>
<td>
<input class="gray" type="password" name="admin_repwd"><label class="fail" style="display:none">二次密码输入的不一致</label>
</td>
</tr>
</tbody></table>
<div id="install_status" style="display:none">
<strong>安装进度</strong>
<span id="install_status_info">正在安装,请稍后...</span>
<div id="install_bar_bg"><span id="install_bar" style="width:0px;"></span></div>
</div>
</div>
</div>
</div>
<p style="text-align:right">
<input class="button" type="button" onclick="window.location.href = 'index.php?step=2';" value="上一步"><input class="button" type="submit" value="下一步" /></p></form>
</div>
<iframe name='install_iframe' style='width:0;height:0;display:none;' src='#'></iframe>
<script type='text/javascript'>
//检查表单信息
function check_form()
{
$('label.error').hide();
var checkObj =
{
db_name :/^.+$/i,
db_user :/^.+$/,
db_pre :/\w+/,
admin_user:/^.{4,20}$/i,
admin_pwd :/^.{6,20}$/i
};
for(val in checkObj)
{
var matchResult = $.trim($('[name="'+val+'"]').val()).match(checkObj[val]);
if(matchResult == null)
{
$('[name="'+val+'"]').focus().next("label").show();
return false;
}
else $('[name="'+val+'"]').focus().next("label").hide();
}
if($('[name="admin_repwd"]').val() != $('[name="admin_pwd"]').val())
{
$('[name="admin_repwd"]').focus().next("label").show();
return false;
}
else{
$('[name="admin_repwd"]').focus().next("label").hide();
}
//$('#install_status').show();
//$('.next').attr('disabled','disabled');
return true;
}
//检查mysql链接
function check_connect()
{
var sendData = {'db_address':'','db_user':'','db_pwd':''};
for(val in sendData)
{
sendData[val] = $('[name="'+val+'"]').val();
}
$.get('index.php?action=checkConnect&'+Math.random(),sendData,function(content)
{
if(content == "success")
{
$('#connect_status').removeClass('connect_fail').addClass('connect_success').text('数据库连接正确').show();
}
else
{
$('#connect_status').removeClass('connect_success').addClass('connect_fail').text('数据库连接检测失败,请核对用户名及密码是否正确!').show();
}
});
}
</script>