Advertisement
GameNCode

delUser.jsp

Mar 6th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <%@ page language="java" contentType="text/html; charset=windows-1255" pageEncoding="windows-1255"%>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
  4. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  5.  
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
  9. <link rel="stylesheet" type="text/css" href="Style.css">
  10. <title>Database Usage</title>
  11. </head>
  12. <body>
  13. <img src="${pageContext.request.contextPath}/images/pen.jpg" height = "500px" width = "1000px" align = "middle"/>
  14. <a name="home"></a>
  15. <ul>
  16. <li><a href="#">Home</a></li>
  17. <li><a href="#news">News</a></li>
  18. <li><a href="ContactUs.jsp">Contact</a></li>
  19. <li><a href="#about">About</a></li>
  20. <li><a href="Signup.jsp">Sign Up</a></li>
  21. </ul>
  22. <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
  23. url="jdbc:mysql://localhost/userdb"
  24. user="root" password="Royboy007"/>
  25. <sql:query dataSource="${snapshot}" var="result">
  26. select * from members where user ='<%=session.getAttribute("user")%>';
  27. </sql:query>
  28. <sql:query dataSource="${snapshot}" var="users">
  29. SELECT * from members;
  30. </sql:query>
  31. <form id="delete" action="deleter.jsp" method="get">
  32. <c:choose>
  33. <c:when test="${result.rows[0].admin == '12345'}">
  34. <c:out value = "If you are sure you want to delete your account...:"/>
  35. <select name="delUser">
  36. <c:forEach var="row" items="${users.rows}">
  37. <option value="${row.user}">${row.user}</option>
  38. </c:forEach>
  39. </select>
  40. </c:when>
  41. <c:otherwise>
  42. <%response.sendRedirect("notAdmin.jsp"); %>
  43. </c:otherwise>
  44. </c:choose>
  45. <input type="submit">
  46.  
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement