step3.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>{$title|default=''} - {$powered|default=''}</title>
  6. <link rel="stylesheet" href="css/install.css" />
  7. </head>
  8. <body>
  9. <div class="wrap">
  10. <div class="header">
  11. <h1 class="logo">logo</h1>
  12. <div class="icon_install">安装向导</div>
  13. <div class="version"></div>
  14. </div>
  15. <section class="section">
  16. <div class="step">
  17. <ul>
  18. <li class="on"><em>1</em>检测环境</li>
  19. <li class="current"><em>2</em>创建数据</li>
  20. <li><em>3</em>完成安装</li>
  21. </ul>
  22. </div>
  23. <form id="J_install_form" action="?step=4" method="post">
  24. <input type="hidden" name="force" value="0" />
  25. <div class="server">
  26. <table width="100%">
  27. <tr>
  28. <td class="td1" width="100">数据库信息</td>
  29. <td class="td1" width="200">&nbsp;</td>
  30. <td class="td1">&nbsp;</td>
  31. </tr>
  32. <tr>
  33. <td class="tar">数据库服务器:</td>
  34. <td><input type="text" name="dbhost" id="dbhost" value="127.0.0.1" class="input"></td>
  35. <td><div id="J_install_tip_dbhost"><span class="gray">数据库服务器地址,一般为127.0.0.1</span></div></td>
  36. </tr>
  37. <tr>
  38. <td class="tar">数据库端口:</td>
  39. <td><input type="text" name="dbport" id="dbport" value="3306" class="input"></td>
  40. <td><div id="J_install_tip_dbport"><span class="gray">数据库服务器端口,一般为3306</span></div></td>
  41. </tr>
  42. <tr>
  43. <td class="tar">数据库用户名:</td>
  44. <td><input type="text" name="dbuser" id="dbuser" value="root" class="input"></td>
  45. <td><div id="J_install_tip_dbuser"></div></td>
  46. </tr>
  47. <tr>
  48. <td class="tar">数据库密码:</td>
  49. <td><input type="password" name="dbpw" id="dbpw" value="" class="input" autoComplete="off" onBlur="TestDbPwd(0)"></td>
  50. <td><div id="J_install_tip_dbpw"></div></td>
  51. </tr>
  52. <tr>
  53. <td class="tar">数据库名:</td>
  54. <td><input type="text" name="dbname" id="dbname" value="crmeb" class="input" onBlur="TestDbPwd(0)"></td>
  55. <td><div id="J_install_tip_dbname"></div></td>
  56. </tr>
  57. <tr>
  58. <td class="tar">数据库表前缀:</td>
  59. <td><input type="text" name="dbprefix" id="dbprefix" value="eb_" class="input" ></td>
  60. <td><div id="J_install_tip_dbprefix"><span class="gray">建议使用默认,同一数据库安装多个CRMEB时需修改</span></div></td>
  61. </tr>
  62. <tr>
  63. <td class="tar">演示数据:</td>
  64. <td colspan="2"><input style="width:18px;height:18px;" type="checkbox" id="demo" name="demo" value="demo" checked></td>
  65. </tr>
  66. </table>
  67. <table width="100%">
  68. <tr>
  69. <td class="td1" width="100">redis数据库信息</td>
  70. <td class="td1" width="200">&nbsp;</td>
  71. <td class="td1">&nbsp;</td>
  72. </tr>
  73. <tr>
  74. <td class="tar">服务器地址:</td>
  75. <td><input type="text" name="rbhost" id="rbhost" value="127.0.0.1" class="input"></td>
  76. <td><div id="J_install_rbhost"><span class="gray">redis服务器地址,一般为127.0.0.1</span></div></td>
  77. </tr>
  78. <tr>
  79. <td class="tar">端口号:</td>
  80. <td><input type="text" name="rbport" id="rbport" value="6379" class="input" autoComplete="off"></td>
  81. <td><div id="J_install_tip_manager_pwd"><span class="gray">redis端口,默认为6379</span></div></td>
  82. </tr>
  83. <tr>
  84. <td class="tar">数据库:</td>
  85. <td><input type="text" name="rbselect" id="rbselect" value="0" class="input" autoComplete="off"></td>
  86. <td><div id="J_install_tip_manager_ckpwd"><span class="gray">redis数据库,默认为0,一般不做更改</span></div></td>
  87. </tr>
  88. <tr>
  89. <td class="tar">数据库密码:</td>
  90. <td><input type="password" name="rbpw" onBlur="TestDbPwd(0)" id="rbpw" value="" class="input" autoComplete="off"></td>
  91. <td><div id="J_install_tip_dbpw"></div><span class="gray">redis数据库密码</span></td>
  92. </tr>
  93. </table>
  94. <table width="100%">
  95. <tr>
  96. <td class="td1" width="100">管理员信息</td>
  97. <td class="td1" width="200">&nbsp;</td>
  98. <td class="td1">&nbsp;</td>
  99. </tr>
  100. <tr>
  101. <td class="tar">管理员帐号:</td>
  102. <td><input type="text" name="manager" id="manager" value="admin" class="input"></td>
  103. <td><div id="J_install_tip_manager"></div></td>
  104. </tr>
  105. <tr>
  106. <td class="tar">管理员密码:</td>
  107. <td><input type="password" name="manager_pwd" id="manager_pwd" class="input" value="" autoComplete="off"></td>
  108. <td><div id="J_install_tip_manager_pwd"></div></td>
  109. </tr>
  110. <tr>
  111. <td class="tar">重复密码:</td>
  112. <td><input type="password" name="manager_ckpwd" id="manager_ckpwd" class="input" value="" autoComplete="off"></td>
  113. <td><div id="J_install_tip_manager_ckpwd"></div></td>
  114. </tr>
  115. </table>
  116. <!-- <div class="on-other" style="color: #ccc">多项目部署配置</div>-->
  117. <!-- <table width="100%" class="other" style="display: none">-->
  118. <!-- <tr>-->
  119. <!-- <td class="td1" width="100">多项目部署配置</td>-->
  120. <!-- <td class="td1" width="200">&nbsp;</td>-->
  121. <!-- <td class="td1">&nbsp;</td>-->
  122. <!-- </tr>-->
  123. <!-- <tr>-->
  124. <!-- <td class="tar">缓存前缀:</td>-->
  125. <!-- <td><input type="text" name="cache_prefix" id="cache_prefix" value="" class="input"></td>-->
  126. <!-- <td><div id="J_install_tip_manager"></div><span class="gray">多项目部署下可填写不同的缓存前缀,单个项目部署可留空</span></td>-->
  127. <!-- </tr>-->
  128. <!-- <tr>-->
  129. <!-- <td class="tar">缓存标签前缀:</td>-->
  130. <!-- <td><input type="text" name="cache_tag_prefix" id="cache_tag_prefix" class="input" autoComplete="off"></td>-->
  131. <!-- <td><div id="J_install_tip_manager_pwd"></div><span class="gray">多项目部署下可填写不同的缓存前缀,单个项目部署可留空</span></td>-->
  132. <!-- </tr>-->
  133. <!-- </table>-->
  134. <div id="J_response_tips" style="display:none;"></div>
  135. </div>
  136. <div class="bottom tac"> <a href="?step=2" class="btn">上一步</a>
  137. <button type="button" onClick="checkForm();" class="btn btn_submit J_install_btn">创建数据</button>
  138. </div>
  139. </form>
  140. </section>
  141. <div style="width:0;height:0;overflow:hidden;"> <img src="images/install/pop_loading.gif"> </div>
  142. <script src="js/jquery.js?v=9.0"></script>
  143. <script src="js/validate.js?v=9.0"></script>
  144. <script src="js/ajaxForm.js?v=9.0"></script>
  145. <script>
  146. $('.on-other').click(function () {
  147. $('.other').toggle();
  148. }).mouseover(function () {
  149. $(this).css('color','#417b9d');
  150. }).mouseout(function () {
  151. $(this).css('color','#ccc');
  152. });
  153. function TestDbPwd(connect_db)
  154. {
  155. var dbHost = $('#dbhost').val();
  156. var dbUser = $('#dbuser').val();
  157. var dbPwd = $('#dbpw').val();
  158. var dbName = $('#dbname').val();
  159. var dbport = $('#dbport').val();
  160. var demo = $('#demo').val();
  161. var data={
  162. 'dbHost': dbHost,
  163. 'dbUser': dbUser,
  164. 'dbPwd': dbPwd,
  165. 'dbName': dbName,
  166. 'dbport': dbport,
  167. 'demo': demo,
  168. rbhost: $('#rbhost').val(),
  169. rbport: $("#rbport").val(),
  170. rbselect: $("#rbselect").val(),
  171. rbpw: $('#rbpw').val(),
  172. cache_prefix:$('#cache_prefix').val(),
  173. cache_tag_prefix:$('#cache_tag_prefix').val(),
  174. workerman_admin_port:$('#workerman_admin_port').val(),
  175. workerman_chat_port:$('#workerman_chat_port').val(),
  176. workerman_channel_port:$('#workerman_channel_port').val(),
  177. };
  178. var url = "?step=3&testdbpwd=1";
  179. $.ajax({
  180. type: "POST",
  181. url: url,
  182. data: data,
  183. dataType:'JSON',
  184. beforeSend:function(){
  185. },
  186. success: function(msg){
  187. if(msg == 1){
  188. if(connect_db == 1)
  189. {
  190. $("#J_install_form").submit(); // ajax 验证通过后再提交表单
  191. }
  192. $('#J_install_tip_dbpw').html('');
  193. $('#J_install_tip_dbname').html('');
  194. $('#J_install_rbhost').html('');
  195. }
  196. else if(msg == -1)
  197. {
  198. $('#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>');
  199. }
  200. else if(msg == -2)
  201. {
  202. $('#J_install_tip_dbname').html('<span for="dbname" generated="true" class="tips_error" style="">你的不是空数据库, 请更换一个数据库名字</span>');
  203. } else if(msg == -3){
  204. $('#J_install_tip_dbpw').html('');
  205. $('#J_install_tip_dbname').html('');
  206. $('#J_install_rbhost').html('<span for="dbname" generated="true" class="tips_error" style="">Redis数据库没有启动或者密码错误</span>');
  207. }else{
  208. $('#dbpw').val("");
  209. $('#J_install_tip_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">数据库链接配置失败</span>');
  210. }
  211. },
  212. complete:function(){
  213. },
  214. error:function(){
  215. $('#J_install_tip_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">数据库链接配置失败</span>');
  216. $('#dbpw').val("");
  217. }
  218. });
  219. }
  220. function checkForm()
  221. {
  222. manager = $.trim($('#manager').val()); //用户名表单
  223. manager_pwd = $.trim($('#manager_pwd').val()); //密码表单
  224. manager_ckpwd = $.trim($('#manager_ckpwd').val()); //密码提示区
  225. if(manager.length == 0 )
  226. {
  227. alert('管理员账号不能为空');
  228. return false;
  229. }
  230. if(!/^[0-9a-zA-Z]{3,20}$/.test(manager))
  231. {
  232. alert('管理员账号应为3-20位数字和字母');
  233. return false;
  234. }
  235. if(manager_pwd.length < 6 )
  236. {
  237. alert('管理员密码必须6位数以上');
  238. return false;
  239. }
  240. if(manager_ckpwd != manager_pwd)
  241. {
  242. alert('两次密码不一致');
  243. return false;
  244. }
  245. TestDbPwd(1);
  246. }
  247. </script>
  248. </div>
  249. <div class="footer"> &copy; 2014-2022 <a href="http://www.crmeb.com" target="_blank">www.crmeb.com</a> 西安众邦网络科技有限公司出品</div>
  250. </body>
  251. </html>