step3.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title><?php echo $Title; ?> - <?php echo $Powered; ?></title>
  6. <link rel="stylesheet" href="./css/install.css?v=9.0" />
  7. </head>
  8. <body>
  9. <div class="wrap">
  10. <?php require './templates/header.php';?>
  11. <section class="section">
  12. <div class="step">
  13. <ul>
  14. <li class="on"><em>1</em>检测环境</li>
  15. <li class="current"><em>2</em>创建数据</li>
  16. <li><em>3</em>完成安装</li>
  17. </ul>
  18. </div>
  19. <form id="J_install_form" action="index.php?step=4" method="post">
  20. <input type="hidden" name="force" value="0" />
  21. <div class="server">
  22. <table width="100%">
  23. <tr>
  24. <td class="td1" width="100">数据库信息</td>
  25. <td class="td1" width="200">&nbsp;</td>
  26. <td class="td1">&nbsp;</td>
  27. </tr>
  28. <tr>
  29. <td class="tar">数据库服务器:</td>
  30. <td><input type="text" name="dbhost" id="dbhost" value="127.0.0.1" class="input"></td>
  31. <td><div id="J_install_tip_dbhost"><span class="gray">数据库服务器地址,一般为127.0.0.1</span></div></td>
  32. </tr>
  33. <tr>
  34. <td class="tar">数据库端口:</td>
  35. <td><input type="text" name="dbport" id="dbport" value="3306" class="input"></td>
  36. <td><div id="J_install_tip_dbport"><span class="gray">数据库服务器端口,一般为3306</span></div></td>
  37. </tr>
  38. <tr>
  39. <td class="tar">数据库用户名:</td>
  40. <td><input type="text" name="dbuser" id="dbuser" value="root" class="input"></td>
  41. <td><div id="J_install_tip_dbuser"></div></td>
  42. </tr>
  43. <tr>
  44. <td class="tar">数据库密码:</td>
  45. <td><input type="password" name="dbpw" id="dbpw" value="" class="input" autoComplete="off" onBlur="TestDbPwd(0)"></td>
  46. <td><div id="J_install_tip_dbpw"></div></td>
  47. </tr>
  48. <tr>
  49. <td class="tar">数据库名:</td>
  50. <td><input type="text" name="dbname" id="dbname" value="liuniu" class="input" onBlur="TestDbPwd(0)"></td>
  51. <td><div id="J_install_tip_dbname"></div></td>
  52. </tr>
  53. <tr>
  54. <td class="tar">数据库表前缀:</td>
  55. <td><input type="text" name="dbprefix" id="dbprefix" value="eb_" class="input" ></td>
  56. <td><div id="J_install_tip_dbprefix"><span class="gray">建议使用默认,同一数据库安装多个Kirin_Base时需修改</span></div></td>
  57. </tr>
  58. <tr>
  59. <td class="tar">演示数据:</td>
  60. <td colspan="2"><input style="width:18px;height:18px;" type="checkbox" id="demo" name="demo" value="demo" checked></td>
  61. </tr>
  62. </table>
  63. <table width="100%">
  64. <tr>
  65. <td class="td1" width="100">管理员信息</td>
  66. <td class="td1" width="200">&nbsp;</td>
  67. <td class="td1">&nbsp;</td>
  68. </tr>
  69. <tr>
  70. <td class="tar">管理员帐号:</td>
  71. <td><input type="text" name="manager" id="manager" value="admin" class="input"></td>
  72. <td><div id="J_install_tip_manager"></div></td>
  73. </tr>
  74. <tr>
  75. <td class="tar">管理员密码:</td>
  76. <td><input type="password" name="manager_pwd" id="manager_pwd" class="input" autoComplete="off"></td>
  77. <td><div id="J_install_tip_manager_pwd"></div></td>
  78. </tr>
  79. <tr>
  80. <td class="tar">重复密码:</td>
  81. <td><input type="password" name="manager_ckpwd" id="manager_ckpwd" class="input" autoComplete="off"></td>
  82. <td><div id="J_install_tip_manager_ckpwd"></div></td>
  83. </tr>
  84. </table>
  85. <div id="J_response_tips" style="display:none;"></div>
  86. </div>
  87. <div class="bottom tac"> <a href="./index.php?step=2" class="btn">上一步</a>
  88. <button type="button" onClick="checkForm();" class="btn btn_submit J_install_btn">创建数据</button>
  89. </div>
  90. </form>
  91. </section>
  92. <div style="width:0;height:0;overflow:hidden;"> <img src="./images/install/pop_loading.gif"> </div>
  93. <script src="./js/jquery.js?v=9.0"></script>
  94. <script src="./js/validate.js?v=9.0"></script>
  95. <script src="./js/ajaxForm.js?v=9.0"></script>
  96. <script>
  97. function TestDbPwd(connect_db)
  98. {
  99. var dbHost = $('#dbhost').val();
  100. var dbUser = $('#dbuser').val();
  101. var dbPwd = $('#dbpw').val();
  102. var dbName = $('#dbname').val();
  103. var dbport = $('#dbport').val();
  104. var demo = $('#demo').val();
  105. data={'dbHost':dbHost,'dbUser':dbUser,'dbPwd':dbPwd,'dbName':dbName,'dbport':dbport,'demo':demo};
  106. var url = "<?php echo $_SERVER['PHP_SELF']; ?>?step=3&testdbpwd=1";
  107. $.ajax({
  108. type: "POST",
  109. url: url,
  110. data: data,
  111. dataType:'JSON',
  112. beforeSend:function(){
  113. },
  114. success: function(msg){
  115. if(msg == 1){
  116. if(connect_db == 1)
  117. {
  118. $("#J_install_form").submit(); // ajax 验证通过后再提交表单
  119. }
  120. $('#J_install_tip_dbpw').html('');
  121. $('#J_install_tip_dbname').html('');
  122. }
  123. else if(msg == -1)
  124. {
  125. $('#J_install_tip_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">请在mysql配置文件修sql-mode或sql_mode为NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION</span>');
  126. }
  127. else if(msg == -2)
  128. {
  129. $('#J_install_tip_dbname').html('<span for="dbname" generated="true" class="tips_error" style="">你的不是空数据库, 请更换一个数据库名字</span>');
  130. }
  131. else{
  132. $('#dbpw').val("");
  133. $('#J_install_tip_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">数据库链接配置失败</span>');
  134. }
  135. },
  136. complete:function(){
  137. },
  138. error:function(){
  139. $('#J_install_tip_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">数据库链接配置失败</span>');
  140. $('#dbpw').val("");
  141. }
  142. });
  143. }
  144. function checkForm()
  145. {
  146. manager = $.trim($('#manager').val()); //用户名表单
  147. manager_pwd = $.trim($('#manager_pwd').val()); //密码表单
  148. manager_ckpwd = $.trim($('#manager_ckpwd').val()); //密码提示区
  149. if(manager.length == 0 )
  150. {
  151. alert('管理员账号不能为空');
  152. return false;
  153. }
  154. if(manager_pwd.length < 6 )
  155. {
  156. alert('管理员密码必须6位数以上');
  157. return false;
  158. }
  159. if(manager_ckpwd != manager_pwd)
  160. {
  161. alert('两次密码不一致');
  162. return false;
  163. }
  164. TestDbPwd(1);
  165. }
  166. </script>
  167. </div>
  168. <?php require './templates/footer.php';?>
  169. </body>
  170. </html>