-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.jsp
66 lines (52 loc) · 1.67 KB
/
edit.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
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Edit user info</title>
<style>
.button {
background-color: #008CBA;
font-size: 16px;
border: none;
color: white;}
</style>
</head>
<body style="background-color:#F0F8FF;">
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*"%>
<%
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://group31.cwwhhyxvfxql.us-east-2.rds.amazonaws.com:3306/group31","Yuchen_jin","Jinyuchen2016*");
Statement st = con.createStatement();
int id = Integer.parseInt(request.getParameter("edit"));
ResultSet rs=st.executeQuery("select * from End_User where account_id ='" + id + "'");
if(rs.next()){
out.print("<center><h1>The user ID is: " + id +"</h1></center><br>");
session.setAttribute("edit_id",id);
%>
<table style="margin: 0px auto;">
<tr>
<td>Change the Username:</td>
<td><a href = edit_uname.html><button class="button">Edit Username</button></a></td>
</tr>
<tr>
<td>Or you want to:</td>
<td><a href = edit_pwd.html><button class="button">Edit Password</button></a></td>
</tr>
</table>
<%
}else{
out.print("Error: ID doesn't exist");
}
con.close();
}catch (Exception ex) {
out.print("Error occured");
}
%>
</body>
</html>