-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreate.jsp
48 lines (48 loc) · 1.83 KB
/
Create.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
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<!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>Creating Account</title>
</head>
<body>
<c:choose>
<c:when test="${(empty param.reguname || empty param.regemail || empty param.regnum || empty param.regpass || empty param.regfname || empty param.reglname)}">
Error!!!<br />
</c:when>
<c:otherwise>
Creating Account...<br />
<%@ page import="java.sql.*" %>
<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/Users"
user="root" password="aaaaaa"/>
<%
String connectionURL = "jdbc:mysql://localhost/Users";
String email=request.getParameter("regemail");
String pass=request.getParameter("regpass");
String uname=request.getParameter("reguname");
String phone=request.getParameter("regnum");
String fname=request.getParameter("regfname");
String mname=request.getParameter("regmname");
String lname=request.getParameter("reglname");
%>
<sql:update dataSource="${snapshot}" var="result">
INSERT INTO User_Info (Username, password,email,phone,fname,mname,lname)
VALUES ('<%=uname %>', '<%=pass %>', '<%=email %>', '<%=phone %>','<%=fname %>','<%=mname %>','<%=lname %>');
</sql:update>
<%
session.setAttribute("uname", uname);
session.setAttribute("fname", fname);
session.setAttribute("mname", mname);
session.setAttribute("lname", lname);
session.setAttribute("email", email);
session.setAttribute("error", "f");
response.sendRedirect("index.jsp");
%>
</c:otherwise>
</c:choose>
</body>
</html>