Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
77
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. String userid = request.getParameter("uname");
  4. String pwd = request.getParameter("pass");
  5. Class.forName("com.mysql.jdbc.Driver");
  6. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/users",
  7. "root", "*Follow902010!*");
  8. Statement st = con.createStatement();
  9. ResultSet rs;
  10. rs = st.executeQuery("select * from members where uname='" + userid + "' and pass='" + pwd + "'");
  11. if (rs.next()) {
  12. session.setAttribute("userid", userid);
  13. response.sendRedirect("success.jsp");
  14. } else {
  15. out.println("Invalid password <a href='index.html'>try again</a>");
  16. }
  17. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement