Advertisement
Yuvalxp8

RegisterCheck (Using MySQL)

Apr 4th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.27 KB | None | 0 0
  1. <%@ page import="java.io.*,java.util.*,java.sql.*"%>
  2. <%@ page import="javax.servlet.http.*,javax.servlet.*" %>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
  5. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  6.     pageEncoding="ISO-8859-1"%>
  7. <%
  8.     String user = request.getParameter("uname");    
  9.     String pwd = request.getParameter("pass");
  10.     String fname = request.getParameter("fname");
  11.     String lname = request.getParameter("lname");
  12.     String email = request.getParameter("email");
  13.     Class.forName("com.mysql.jdbc.Driver");
  14.     Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/usersinfo",
  15.             "root", "Slnm1855");
  16.     Statement st = con.createStatement();
  17.     //ResultSet rs;
  18.     int i = st.executeUpdate("insert into members(F_name, L_name, email, username, password) values ('" + fname + "','" + lname + "','" + email + "','" + user + "','" + pwd + "','");
  19.     if (i > 0) {
  20.         //session.setAttribute("userid", user);
  21.         response.sendRedirect("forms.jsp");
  22.        // out.print("Registration Successfull!"+"<a href='index.jsp'>Go to Login</a>");
  23.     } else {
  24.         response.sendRedirect("SQLHomePageLogin.jsp");
  25.     }
  26. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement