-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUserReg.jsp
303 lines (250 loc) · 8.18 KB
/
UserReg.jsp
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>User Registration Form</title>
<meta name="keywords" content="Home" />
<link href="./css/templatemo_style.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.ennui.contentslider.css" rel="stylesheet" type="text/css" media="screen,projection" />
<!-- Special Font & Symbol -->
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<!-- Date Picker code -->
<link type="text/css" href="jsDate/css/jquery-ui-1.8.17.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jsDate/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jsDate/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="jsDate/jquery.effects.core.js"></script>
<script type="text/javascript" src="jsDate/jquery.effects.bounce.js"></script>
<script type="text/javascript">
$(function() { //Date Picker For DOB Whic show calendar for age above 18 years and starts from 1920
$( "#datepicker" ).datepicker({ showAnim: 'bounce',
yearRange: '1900:2019',
changeMonth: true,
changeYear: true, maxDate: "-18Y -1D"
});
});
</script>
<style type="text/css">
body{ font: 62.5% "Arial", sans-serif; margin: 50px;}
</style>
<!-- Date Picker Code End -->
<style type="text/css">
body
{
margin-bottom:0;
margin-left:0;
margin-right:0;
margin-top:0;
}
</style>
<script type="text/javascript">
function valid(){
var pass1 = document.getElementById("pass1").value;
var pass2 = document.getElementById("pass2").value;
if( pass1 == pass2){
return true;
}
else{
alert("Password missmatch");
//pass2.focus();
document.getElementById("pass2").focus();
document.getElementById("pass2").select();
document.getElementById("pass2").focus();
return false;
}
}
function credit(){
var val = document.form1.credit.value;
var len = val.length;
if(len < 16 ){
alert("Credit Card No should Be Of 16 Digits");
document.form1.credit.focus();
return false;
}
return true;
}
function validate(){
if(Empty(document.form1.fname)){ //Empty Field Validation Call
if(Empty(document.form1.dob)){
if(Empty(document.form1.email)){
if(Empty(document.form1.credit)){
if (credit()){
if(Empty(document.form1.pass1)){
if(validateEmail(document.form1.email)) { //Email Input Type Validation Call
if(valid()){ //Retype Password Validation Call
document.form1.submit();
}
}
}
}
}
}
}
}
}
</script>
<!-- Input Validation Script -->
<script type="text/javascript" src="InputValidation.js">
</script>
<%!
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
public void jspInit(){
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/train","root","");
}
catch(Exception e ){
e.printStackTrace();
}
}
%>
<script>
$(function(){
$("#header").load("header.html");
});
</script>
<script>
$(function(){
$("#footer").load("footer.html");
});
</script>
</head>
<body>
<div id="templatemo_wrapper">
<div id="templatemo_header">
<div id="site_title">
<h1><a href="home.jsp">
<img src="./images/logo.jpg" alt="Commuters Guide" width="480" height="93" />
</a></h1>
</div>
<!-- end of templatemo_menu -->
<div class="cleaner"></div>
</div> <!-- end of header -->
<div id="header"></div>
<div id="templatemo_content">
<!-- Form Body -->
<div style="font-family:'Times New Roman', Times, serif;font-size:16px">
<form name="form1" action="./UserReg1.jsp">
<h1 align="center"> <em> User Registration Form </em> </h1>
<br />
<table>
<tr>
<td ><label > First Name </label></td>
<td><input type="text" name="fname" value="" maxlength="15" onkeyup="alp(this)" onkeydown="alp(this)" title="First Name" /> <span style="color: red;">*</span> </td>
<td><label> Last Name </label></td>
<td><input type="text" name="lname" value="" maxlength="15" onkeyup="alp(this)" onkeydown="alp(this)" /></td>
</tr>
<tr>
<td><label> Gender </label></td>
<td><select name="gender">
<option selected="selected"> Male </option>
<option> Female </option>
</select>
</td>
<td><label>Date Of Birth </label></td>
<td><input type="text" id="datepicker" title="YYYY/MM/DD" name="dob" readonly="readonly" /> <span style="color: red;">*</span> </td>
<!-- <td><input title="YYYY/MM/DD" type="text" name="dob" /></td> -->
</tr>
<tr>
<td><label>Email ID</label></td>
<td><input type="text" name="email" maxlength="30" onkeyup="EmailInsert(this);" onkeydown="EmailInsert(this);" onblur="validEmail(this);" /> <span style="color: red;">*</span></td>
<td><label>Mobile</label></td>
<td><input type="text" name="mobile" maxlength="10" onkeyup="num(this);" onkeydown="num(this);" /></td>
</tr>
<tr>
<td><label>Credit Card No</label></td>
<td><input type="text" name="credit" maxlength="16" onkeyup="num(this)" onkeydown="num(this);" /> <span style="color: red;">*</span> </td>
</tr>
<tr>
<td rowspan="2"><label> Address </label></td>
<td rowspan="2"><textarea rows="3" cols="25" name="addr"> </textarea></td>
</tr>
<tr>
</tr>
<tr>
<td><label> City </label></td>
<td><input type="text" name="city" onkeyup="alp1(this)" onkeydown="alp1(this)" /></td>
</tr>
<tr>
<td><label> State </label></td>
<td><input type="text" name="state" maxlength="30" onkeyup="alp1(this)" onkeydown="alp1(this)" /></td>
</tr>
<tr>
<td><label> Pin Code </label></td>
<td> <input type="text" name ="pin" maxlength="6" onkeyup="num(this)" onkeydown="num(this)" /> </td>
</tr>
<tr>
<td><label> Country </label></td>
<td><input type="text" name="country" maxlength="30" onkeyup="alp1(this)" onkeydown="alp1(this)" /> </td>
</tr>
</table>
<br/>
<hr />
<h3>Login Information</h3>
<table border="0">
<tr>
<td><label>User Id</label> </td>
<td> <input type="text" name="userid" value=
<%
String sql1="select MAX(User_Id) + 1 from reg_user";
pstmt = con.prepareStatement(sql1);
rs=pstmt.executeQuery();
int _uid=1;
while (rs.next()){
_uid = rs.getInt(1);
%>
<%--=rs.getString(1) + 1 --%>
<%
}
if (_uid == 0){
_uid = 1000;
}
%>
"<%= _uid%>"
readonly="readonly" /></td>
</tr>
<tr>
<td><label>Enter Password</label> </td>
<td> <input type="password" id="pass1" name="password1" maxlength="6" /> <span style="color: red;">*</span> </td>
</tr>
<tr>
<td><label>Conform Password</label> </td>
<td> <input type="password" id="pass2" name="password2" maxlength="6" onchange="valid()" /> </td>
</tr>
</table>
<span style="color: red;">Field Marked With * Should be field</span>
<br />
<br />
<p align="center">
<button type="button" value="Register" class="btn btn-warning" id="sub" onclick="validate()">Register</button>
<button type ="reset" value="Clear" class="btn btn-warning" id="clear">Reset</button>
</p>
</form>
</div>
<!-- Form Body -->
</div> <!-- end of templatemo_content -->
<div id="templatemo_sidebar">
<div id="sidebar_featured_project">
<div class="cleaner"></div>
<div class="cleaner"></div>
<div class="cleaner"></div>
<div class="cleaner"></div>
<h3>Information</h3>
<div class="right" >
<h6 ><a href="SearchTrain.jsp">Trains Btw Stations</a></h6>
<h6><a href="SearchSchedule.jsp">Train Schedules</a></h6>
<h6><a href="ViewFare.jsp">Fare List</a></h6>
<h6><a href="http://www.indianrail.gov.in" target="_new">Other Railway Websites </a></h6>
</div>
<div class="cleaner"></div>
</div>
<div class="cleaner"></div>
</div>
</div> <!-- end of wrapper -->
<div id="footer"></div>
</body>
</html>