diff --git a/WebContent/html/webpages/redirect/createProfile.jsp b/WebContent/html/webpages/redirect/createProfile.jsp new file mode 100644 index 0000000..e3f9b4c --- /dev/null +++ b/WebContent/html/webpages/redirect/createProfile.jsp @@ -0,0 +1,54 @@ +<%@ page import = "database.*,entities.Device" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Synchrony Financial + + + + + + + + +

Redirect Page

+

You shouldn't be seeing this page :)

+ +<% +//make instance +Cookie userCookie,newCookie; +String sso = request.getParameter("sso"); +String name = request.getParameter("name"); +String loc = request.getParameter("loc"); +String ph = request.getParameter("ph"); +String email = request.getParameter("email"); +//form was submitted +if(request.getParameter("submit") != null){ + EmployeeQueries.addEmployee(sso,loc,name,ph,email); + request.getSession(); + session.setAttribute("ssoNum", sso); + userCookie = new Cookie("ssoNum", sso); + userCookie.setMaxAge(30*60); + userCookie.setPath("/"); + response.addCookie(userCookie); + newCookie = new Cookie("name",name); + newCookie.setMaxAge(30*60); + newCookie.setPath("/"); + response.addCookie(newCookie); + response.sendRedirect("../index.jsp"); +} + +%> + + \ No newline at end of file diff --git a/WebContent/html/webpages/userLogin.jsp b/WebContent/html/webpages/userLogin.jsp new file mode 100644 index 0000000..f3f35ff --- /dev/null +++ b/WebContent/html/webpages/userLogin.jsp @@ -0,0 +1,108 @@ +<%@ page import = "database.*,entities.Location" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page import = "java.sql.*" %> + + + + + + + + + + Synchrony Financial + + + + + + + + + + + + + + + +<% +Cookie userCookie,newCookie; + +int ssoNum = Integer.parseInt(request.getParameter("username")); + +Class.forName("com.mysql.jdbc.Driver"); +String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317"; +String user = "b372dfe7409692"; +String password = "74f6e317"; +Connection connection = DriverManager.getConnection(database, user, password); +Statement stmt = connection.createStatement(); +ResultSet result; +result = stmt.executeQuery("select * FROM employee where Employee_ID='" + ssoNum + "'"); + +if (result.next()){ + request.getSession(); + session.setAttribute("ssoNum", ssoNum); + userCookie = new Cookie("ssoNum", Integer.toString(ssoNum)); + userCookie.setMaxAge(30*60); + userCookie.setPath("/"); + response.addCookie(userCookie); + newCookie = new Cookie("name",result.getString("Name")); + newCookie.setMaxAge(30*60); + newCookie.setPath("/"); + response.addCookie(newCookie); + stmt.close(); + connection.close(); + response.sendRedirect("index.jsp"); +} +connection.close(); +stmt.close(); +String locations = Location.arrayToString(LocationQueries.getLocations(ssoNum)); +%> + + \ No newline at end of file diff --git a/WebContent/index.jsp b/WebContent/index.jsp index a5d580e..7c4f219 100644 --- a/WebContent/index.jsp +++ b/WebContent/index.jsp @@ -94,7 +94,7 @@