Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <%@ page import ="java.sql.*" %>
  2.  
  3. <%
  4. String userid = request.getParameter("uname");
  5. String pwd = request.getParameter("pass");
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/users",
  8. "root", "*Follow902010!*");
  9. Statement st = con.createStatement();
  10. ResultSet rs;
  11. rs = st.executeQuery("select * from members where uname='" + userid + "' and pass='" + pwd + "'");
  12. if (rs.next()) {
  13. session.setAttribute("userid", userid);
  14. response.sendRedirect("success.jsp");
  15. } else {
  16. out.println("Invalid password <a href='index.html'>try again</a>");
  17. }
  18. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement