Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : passwordForm
- Created on : Nov 26, 2017, 2:24:41 AM
- Author : hp
- --%>
- <%@page import = "java.io.File"%>
- <%@page import = "org.apache.commons.fileupload.FileItem"%>
- <%@page import = "java.util.Iterator"%>
- <%@page import = "org.apache.commons.fileupload.FileUploadException"%>
- <%@page import = "java.util.List"%>
- <%@page import = "org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
- <%@page import = "org.apache.commons.fileupload.FileItemFactory"%>
- <%@page import = "org.apache.commons.fileupload.servlet.ServletFileUpload"%>
- <%@page import = "java.sql.ResultSet"%>
- <%@page import = "java.sql.Connection"%>
- <%@page import = "java.sql.Statement"%>
- <%@page import = "java.sql.DriverManager"%>
- <%@page contentType = "text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <%
- String UserID = "";
- if (((String) session.getAttribute("UserID")) != null) {
- UserID = (String) session.getAttribute("UserID");
- }
- String Group = "";
- if (((String) session.getAttribute("Group")) != null) {
- Group = (String) session.getAttribute("Group");
- }
- String Name = "";
- if (((String) session.getAttribute("Name")) != null) {
- Name = (String) session.getAttribute("Name");
- }
- %>
- <html>
- <head>
- <title>Product</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
- <link rel="stylesheet" href="css/layout.css" type="text/css" />
- <script type="text/javascript" src="jquery.min.js"></script>
- <!-- Waterwheel Carousel -->
- <script type="text/javascript" src="jquery.waterwheelCarousel.min.js"></script>
- <script type="text/javascript" src="jquery.waterwheelCarousel.setup.js"></script>
- <!-- / Waterwheel Carousel -->
- <script language="JavaScript" src="addImage.js">
- </script>
- </head>
- <body id="top">
- <div class="wrapper col1">
- <div id="header">
- <h1><a href="HOMEPAGE.html">MISS BROWNIES</a></h1>
- <%
- if (Group.equals("Customer")) {
- %>
- <br>
- <br>
- <h6>Welcome <%=Name%>! </h6>
- <%
- } else if (Group.equals("Admin")) {
- %>
- <br>
- <br>
- <h6>Welcome Admin <%=Name%>! </h6>
- <%
- }
- %>
- </div>
- </div>
- <!-- ####################################################################################################### -->
- <div class="wrapper col3">
- <div id="topbar">
- <div id="topnav">
- <ul>
- <%
- if (UserID.equals("")) {
- %>
- <li class="active"><a href="Login.jsp">Login</a></li>
- <li><a href="homepage.jsp">Homepage</a></li>
- <li><a href="about.jsp">About Us</a></li>
- <li><a href="">Custom >> </a>
- <ul>
- <li><a href="product.jsp">Gallery</a></li>
- <li><a href="custom.jsp">Product</a></li>
- </ul>
- </li>
- <li><a href="contact.jsp">Contact Us</a></li>
- <%
- }
- %>
- <!-- MENU FOR CUSTOMER -->
- <%
- if (Group.equals("Customer")) {
- if (UserID.equals("")) {
- %>
- <li class="active"><a href="Login.jsp">Login</a></li>
- <%
- }
- %>
- <li><a href="homepage.jsp">Homepage</a></li>
- <li><a href="about.jsp">About Us</a></li>
- <li><a href="contact.jsp">Contact Us</a></li>
- <li><a href="">Custom >> </a>
- <ul>
- <li><a href="product.jsp">Gallery</a></li>
- <li><a href="custom.jsp">Product</a></li>
- </ul>
- </li>
- <%
- if (!UserID.equals("")) {
- %>
- <li><a href="">My Account >></a>
- <ul>
- <li><a href="profile.jsp">Profile</a></li>
- <li><a href="passwordForm.jsp">Change Password</a></li>
- <li><a href="myorder.jsp">Order</a></li>
- </ul
- </li>
- <li><a href="logout.jsp">Logout</a></li>
- <!-- MENU FO ADMIN -->
- <%
- }
- } else if (Group.equals("Admin")) {
- if (UserID.equals("")) {
- %>
- <li><a href="Login.jsp">Login</a></li>
- <%
- }
- %>
- <li><a href="homepage.jsp">Homepage</a></li>
- <li><a href="about.jsp">About Us</a></li>
- <li><a href="custom.jsp">Product</a></li>
- <li><a href="">Order >></a>
- <ul>
- <li><a href="orderPending.jsp">Pending</a></li>
- <li><a href="onGoing.jsp">On Going</a></li>
- <li><a href="orderDone.jsp">Done</a></li>
- <li><a href="orderSuccess.jsp">Paid</a></li>
- </ul>
- </li>
- <li><a href="report.jsp">Report</a></li>
- <li><a href="logout.jsp">Logout</a></li>
- <%
- }
- %>
- </ul>
- </div>
- <div id="search">
- <form action="#" method="post">
- <fieldset>
- <legend>Site Search</legend>
- <input type="text" value="Search Our Website…" onfocus="this.value = (this.value == 'Search Our Website…') ? '' : this.value;" />
- <input type="submit" name="go" id="go" value="Search" />
- </fieldset>
- </form>
- </div>
- <br class="clear" />
- </div>
- </div>
- <!-- ####################################################################################################### -->
- <%
- Connection connection = null;
- Class.forName("org.gjt.mm.mysql.Driver");
- String url = "jdbc:mysql://localhost/dbbrownies";
- String user = "root";
- String pwd = "";
- connection = DriverManager.getConnection(url, user, pwd);
- Statement statement = connection.createStatement();
- try {
- String ImageFile = "";
- String itemName = "";
- boolean isMultipart = ServletFileUpload.isMultipartContent(request);
- if (!isMultipart) {
- } else {
- FileItemFactory factory = new DiskFileItemFactory();
- ServletFileUpload upload = new ServletFileUpload(factory);
- List items = null;
- try {
- items = upload.parseRequest(request);
- } catch (FileUploadException e) {
- e.getMessage();
- }
- Iterator itr = items.iterator();
- while (itr.hasNext()) {
- FileItem item = (FileItem) itr.next();
- if (item.isFormField()) {
- String name = item.getFieldName();
- String value = item.getString();
- if (name.equals("ImageFile")) {
- ImageFile = value;
- }
- } else {
- try {
- itemName = item.getName();
- File savedFile = new File(config.getServletContext().getRealPath("/") + "\\images\\" + itemName);
- item.write(savedFile);
- } catch (Exception e) {
- out.println("Error" + e.getMessage());
- }
- }
- }
- try {
- statement.executeUpdate("insert into product(proimage, adminID) values ('" + itemName + "','" + UserID + "')");
- } catch (Exception el) {
- out.println("Inserting error" + el.getMessage());
- }
- }
- } catch (Exception e) {
- out.println(e.getMessage());
- }
- %>
- <!-- ####################################################################################################### -->
- <div class="wrapper col4">
- <div id="container">
- <h1 align="center" style="font-family:Comic Sans MS; font-size:50px; color:#daa520"><b>PRODUCT</b></h1>
- <form name="menu" action="addMenu.jsp" method="post" >
- <table>
- <tr>
- <td colspan="2"><h2 style="font-size:30px;">Add Product</h2></td>
- </tr>
- <tr>
- <td><h1>Name: </h1></td>
- <td><input type="text" name="pName" size="50"></td>
- </tr>
- <tr>
- <td><h1>Topping: </h1></td>
- <td>
- <input type="text" name="pTopping" size="50"></td>
- </tr>
- <tr>
- <td><h1>Price </h1></td>
- <td><input type="text" name="pPrice" size="50"></td>
- </tr>
- <tr>
- <td><h1>Serving </h1></td>
- <td><input type="text" name="pServing" size="50"></td>
- </tr>
- <tr>
- <td><h1>Description </h1></td>
- <td><textarea name="pDesc" rows="6" cols="45"></textarea></td>
- </tr>
- <tr>
- <td> </td>
- <td>
- </br>
- <input type="submit" name="Submit" value="ADD" style="font--size:7pt; background-color:yellow; font-family:Georgia; padding:3px;" onClick="return check()">
- <input type="reset" name="Reset" style="font--size:7pt; background-color:yellow; font-family:Georgia; padding:3px;" value="CANCEL"></br>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </div>
- <!-- ####################################################################################################### -->
- <div class="wrapper col6">
- <div id="copyright">
- <p class="fl_left">Copyright © 2014 - All Rights Reserved - <a href="#">MISS BROWNIES</a></p>
- <p class="fl_right"> <a target="_blank" href="http://www.os-templates.com/" title="Free Website Templates">MISS BROWNIES</a></p>
- <br class="clear" />
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement