严智鑫
2025-03-14 c41e1c8b82b8f4c7b149e0576c9a37bc5b2dbb85
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   
 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- <link href="/CSS&JS/style_checkcode.css" rel="stylesheet" type="text/css">-->
 
    <title>注册</title>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
        a{
            text-decoration: none;
            outline: medium none;
            color: #CF0;
        }
        #wrap {
            height: 80%;
            width: 100%;
            background-repeat: no-repeat;
            background-position: center center;
            position: relative;
        }
        #head {
            height: 10%;
            width: 100%;
            background-color: #66CCCC;
            text-align: center;
            position: relative;
        }
        #foot {
            width: 100%;
            height: 10%;
            background-color: #CC9933;
            position: relative;
        }
        #wrap .logGet {
            height: 458px;
            width: 368px;
            position: absolute;
            background-color: #FFFFFF;
            top: 200px;
            left: 38%;
            
 
        }
        .inputo{
            margin-top: 20px;
            width: 100%;
            height: 45px;
            background-color: rgb(100, 184, 236);
            border: none;
            color: white;
            font-size: 18px;
        }
        .logC a:hover {
            color: #63B1FF;
            text-shadow: 1px 1px 1px #000000;
        }
 
        .logGet .logD.logDtip .p1 {
            display: inline-block;
            font-size: 28px;
            margin-top: 10px;
            width: 86%;
        }
        #wrap .logGet .logD.logDtip {
            width: 86%;
            border-bottom: 1px solid #ee7700;
            margin-bottom: 35px;
            margin-top: 0px;
            margin-right: auto;
            margin-left: auto;
        }
        .logGet .lgD img {
            position: absolute;
            top: 5px;
            left: -19px;
        }
        .logGet .lgD input {
            width: 100%;
            height: 25px;
            text-indent: 2.5rem;
        }
        #wrap .logGet .lgD {
            width: 86%;
            position: relative;
            margin-bottom: 30px;
            margin-top: 10px;
            margin-right: auto;
            margin-left: auto;
        }
        #wrap .logGet .logC {
            width: 86%;
            margin-top: 0px;
            margin-right: auto;
            margin-bottom: 0px;
            margin-left: auto;
        }
 
 
        .title {
            font-family: "宋体";
            color: #FFFFFF;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);  /* 使用css3的transform来实现 */
            font-size: 36px;
            height: 40px;
            width: 30%;
        }
 
        .copyright {
            font-family: "宋体";
            color: #FFFFFF;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);  /* 使用css3的transform来实现 */
            height: 60px;
            width: 40%;
            text-align:center;
        }
 
 
       
    </style>
    
 
 
    </script>
<link rel="shortcut icon"  href="../../img/3.ico" />
</head>
 
<%@include file="../mysqlconnect.jsp"%>
<body  style='background-color:#D5EAFF'  onload="document.form1.userName.focus()" >
<%
                        String yuyan1="cn";
                        String yuyan2=request.getParameter("yuyan");
                        if(yuyan2==""||yuyan2==null){
                            
                        }else{
                            yuyan1=yuyan2;
                        }                                
                        
                        String yemian="Login.jsp";
                        String[] group=new String[6];
                        
                      //装载一个类并且对其进行实例化的操作
                        Class.forName(driverClass);{
                            Connection con1=DriverManager.getConnection( urlglass,user,password);
                            
                            CallableStatement cs = con1.prepareCall("{call yuyan(?,?)}");
                            cs.setString(1, yemian);
                            cs.setString(2, yuyan1);
                            ResultSet rs = cs.executeQuery();
                            int i=0;
                            while(rs.next())
                            {
                                group[i]=rs.getString(1);
                                i++;
                            }
                        }
                        %>
 
<div class="wrap" id="wrap">
<div align="center" >
     <img src='../../img/2.ico'; style='top:38px;align:center;position:absolute;left:700px;width:150px; height:100px;' />
     </div>
    <div class="logGet">
        <!-- 头部提示信息 -->
        <div  align="center" class="logD logDtip">
            <p class="p1">注册</p>
        </div>
        <!-- 输入框 -->
        <form  id="formLogin"   method="post" action="" name="form1" >
            <span style="color: red">${error}</span>
            
  <div class="lgD">
 
                <!--   <img src="img/logName.png" width="20" height="20" alt=""/>-->
             姓名 <!--  <img src='../img/姓名.ico'; width="20" height="20"  />  --><input type="text" name="xingming" id="xingming" maxlength=15 "
                    placeholder="请输入姓名" />
 
            <div id="user_prompt"></div>
            </div>
      <div class="lgD">
 
          
 
                          部门: <td  style="width:80px">
                               <input name="bumen" id="bumen" style='display:none' type="text" value="经营部" >
                               <input name='banzugonghao' type="text" value='' style='display:none'>
                               <input name='banzumingcheng' id='bzmc' style='display:none' readOnly="readonly" type="text" maxlength="10">
                                    <select style='background-color:#D5EAFF;border:none;' name="" id="bm"  onchange='erjixianshi(this)'   style="width:80px;height:20px;border-style:none;outline: none;">
                                      
                                        
                                        
                                        <%
 
                      //装载一个类并且对其进行实例化的操作
                            Class.forName(driverClass);{
                        Connection con=DriverManager.getConnection(urlglass,user,password);
                                //调用存储过程
                                CallableStatement cs = con.prepareCall("{call bumenchaxun}");
                                ResultSet rs = cs.executeQuery();
                                //循环打印数据
                                
                                while(rs.next())
                                {
                                    out.println("<option value='"+rs.getString(1)+"' >"+rs.getString(1)+"</option>");
                                    
                                }
                                
                            
                            }
                        %>
                                    </select>
                                    
                                    
                                    </td>
                                    
                                    
                                     班组: <td  style="width:80px">
                              
                                    <select style='background-color:#D5EAFF;border:none;' name="" id="bz"  onchange='change_banzu()' style="width:80px;height:20px;border-style:none;outline: none;">
                                        <option   value='' id='xuanze' >请选择班组</option>  
                                       
                                        
                                        <%
 
                      //装载一个类并且对其进行实例化的操作
                            Class.forName(driverClass);{
                        Connection con=DriverManager.getConnection(urlglass,user,password);
                                //调用存储过程
                                CallableStatement cs = con.prepareCall("{call banzuchaxun()}");
                                ResultSet rs = cs.executeQuery();
                                //循环打印数据
                                
                                while(rs.next())
                                {
                                    out.println("<option  value='"+rs.getString(2)+"' >"+rs.getString(1)+"</option>");
                                    
                                }
                                
                            
                            }
                        %>
                                    </select>
                                    
                                    
                                    </td>
 
 
 
         
            </div>      
            
        <%--      <div class="lgD">
 
                <!--   <img src="img/logName.png" width="20" height="20" alt=""/>-->
                <!-- <input style="display:none;"  type="text" required='required' maxlength="50" list="banzulist" name='banzubianhao' > -->
                班组: <td><input   type="text" required='required' maxlength="50" list="banzulist" >
                    <datalist id="banzulist"     >
                          <select class="sb">
                          
                          <%
                           Class.forName(driverClass1);{
                        Connection con=DriverManager.getConnection(url1,user1,password1);
                        CallableStatement cs = con.prepareCall("{call banzuchaxun()}");
                        ResultSet rs = cs.executeQuery();
                            while(rs.next()){
                                out.println("<option ' value='"+rs.getString(1)+"' >");
                            }
                            con.close(); 
                    }
                    %>
                          </select>
                      </datalist>
</td>
 
 
            <div id="user_prompt"></div>
            </div>      --%> 
            <div class="lgD">
 
                <!--   <img src="img/logName.png" width="20" height="20" alt=""/>-->
                用户名:<input type="text" name="userName" id="name" maxlength=15
                       placeholder="请输入4到15位(字母,数字,下划线,减号)" />
 
            <div id="user_prompt"></div>
            </div>
            
          
            <div class="lgD">
                <!-- <img src="img/logPwd.png" width="20" height="20" alt=""/>-->
                密码:<input type="password" name="pwd" id="pwd" maxlength=15
                       placeholder="请输入6-15位字母、数字、下划线" />
                       
                <div id="pwd_prompt"></div>
            </div>
 
            <div class="lgD">
               
 
            <div id="repwd_prompt"></div>
            </div>
           
 
            <div class="logC">
                <input name="submit" type="submit"  onclick='return formSub()' value="注册" class="inputo" id="bot"  /><br/>
 
 
            </div>
 
 
        </form>
    </div>
</div>
 
 
 
 
</body>
 
<script src="../../js/jquery-3.4.1.js"></script>
 
<script type="text/javascript"  charset="UTF-8">
 
 
 
 
/*  function change_fktj()
{    
    
    
    
}
  */
 
 function erjixianshi(e)
 {
     /*  alert(e.value); */
      var obj=document.getElementById("bm"); 
        
     var erjibianhao=$("#bz").find('option');
     document.getElementById('bumen').value=obj.options[obj.selectedIndex].innerHTML; 
     for(var i=1;i<erjibianhao.length;i++)
         {
             
             if(e.value=="生产部")
             {
                 erjibianhao[i].style.display="block";
             }
             else
             {
                 erjibianhao[i].style.display="none";
             }
             
         }
 }
     
 
function change_banzu()
{    
    
    var banzuid=document.getElementById("bz");
    
    
    var banzugonghao=banzuid.options[banzuid.selectedIndex].value;
    var banzumingcheng=banzuid.options[banzuid.selectedIndex].innerHTML;
    
    
    $('[name="banzugonghao"]').val(banzuid.options[banzuid.selectedIndex].value);
    
    $('[name="banzumingcheng"]').val(banzuid.options[banzuid.selectedIndex].innerHTML);
    
    
    
    }
    
    
 
function formSub(){
    
    var xingming = $.trim($("#xingming").val());    
    var name = $.trim($("#name").val());
    var xyed3= /^(\w){6,15}$/; 
    var yhm= /^[a-zA-Z0-9_-]{4,15}$/;
    var mobile2 = $("#name").val();
    var phoneReg2 = !!mobile2.match(yhm);
    var mobile1 = $("#pwd").val();
    var phoneReg = !!mobile1.match(xyed3);
    
/* var select_id=document.getElementById("bz");
    
    if(select_id.selectedIndex==0 || select_id.options[select_id.selectedIndex].innerHTML.trim()==''  ){
        
        alert('请选择班组!')
        return false;
    } */
     if(document.getElementById('bumen').value==''){
         alert('还未选择部门');///这里你换成其他更友善的提示调用函数什么的都行
     $("input#bm").focus();
        return false;
    } 
    if(name == ""  || name==null){
        alert("用户名不能为空")
        return false;
    }
    if(phoneReg2 == false){
        alert("用户名只能输入4到15位(字母,数字,下划线,减号) ");
        
        return false;
    }
    
    if(phoneReg == false){
        alert("密码只能输入6-15位字母、数字、下划线 ");
        return false;
    }
    if(xingming == ""){
        alert("姓名不能为空")
        return false;
    }
};
 
 
</script>
 
 <%
 
 String banzu="";
if(request.getParameter("submit")!=null){
     String uname=request.getParameter("userName");
    uname= new String(uname.getBytes("ISO-8859-1"), "utf-8");
    String pwd=request.getParameter("pwd");
    pwd= new String(pwd.getBytes("ISO-8859-1"), "utf-8");    
    String xingming=request.getParameter("xingming");
    xingming= new String(xingming.getBytes("ISO-8859-1"), "utf-8");
    String bumen=request.getParameter("bumen");
    bumen= new String(bumen.getBytes("ISO-8859-1"), "utf-8");
    String bumenbianhao=request.getParameter("bumenbianhao");
    
    /* 
     }  */
 
 
    
     banzu=request.getParameter("banzumingcheng");
                 banzu= new String(banzu.getBytes("ISO-8859-1"), "utf-8");
               
     
    String banzugonghao=request.getParameter("banzugonghao");
    
    banzugonghao= new String(banzugonghao.getBytes("ISO-8859-1"), "utf-8");
    int fanhui=0;
     
  
     
   //装载一个类并且对其进行实例化的操作
     Class.forName(driverClass);{
       if(uname!=null&&pwd!=null){
         
               Connection con=DriverManager.getConnection( urlglass,user,password);
               
               CallableStatement cs = con.prepareCall("{call zhuce(?,?,?,?,?,?,?,?,?)}");
               cs.setString(1, uname);
               cs.setString(2, pwd);
               cs.setString(3, xingming);
               cs.setString(4, bumenbianhao);
               cs.setString(5, bumen);
               cs.setString(6, banzu);
               cs.setString(7, request.getRemoteAddr());
               cs.setString(8, banzugonghao);
               cs.registerOutParameter( 9 , java.sql.Types.INTEGER);
               cs.execute();
               fanhui=cs.getInt(9);
               if(fanhui==5000){    
                   out.print("<script type='text/javascript'>alert('注册成功');window.close()</script>");
 
               }else{
                   out.print("<script type='text/javascript'>alert('注册失败或不能重复注册');</script>");
               }con.close(); 
       }
           
          
       
     }  
     
    
    
    
     %> 
     
     
     
</html>