Question

Hi guys! I need some help with this Web Design mini project. Any help will be appreciated a rated. Thanks in advance!

Here is the project: (It must be implemented using JSP and MySQL) not PHP

Mini Facebook A. Description You are asked to implement a social network B. Requirements You are to implement a computer syst


I need help with the code implementation!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

instruction :

1) your database name is dbname .

2)User is rootand password is dbpass change through the page if you want to.

3) your table name is members.

4) name of the files are written above it, it has to be the same name as mentioned.

5) there are a total of 11 files including sql file.

6) screenshots included.

sql code

CREATE TABLE `members` (

  `id` int(10) unsigned NOT NULL auto_increment,

  `first_name` varchar(45) NOT NULL,

  `last_name` varchar(45) NOT NULL,

  `email` varchar(45) NOT NULL,

  `uname` varchar(45) NOT NULL,

`dob` varchar(45) NOT NULL,

`gender` varchar(45) NOT NULL,

  `address` varchar(100) NOT NULL,

`pass` varchar(45) NOT NULL,

  PRIMARY KEY (`id`)

index.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>LOGIN</title>
    </head>
    <body>
        <form method="post" action="login.jsp">

     <legend> Login to App </legend>

            <center>
            <table border="1" width="30%" cellpadding="3">
                <thead>
                    <tr>
                        <th colspan="2">Login Here</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>User Name</td>
                        <td><input type="text" name="uname" value="" /></td>
                    </tr>
                    <tr>
                        <td>Password</td>
                        <td><input type="password" name="pass" value="" /></td>
                    </tr>
                    <tr>
                        <td><input type="submit" value="Login" /></td>
                        <td><input type="reset" value="Reset" /></td>
                    </tr>
                    <tr>
                        <td colspan="2">Yet Not Registered!! <a href="reg.jsp">Register Here</a></td>
                    </tr>

                </tbody>
            </table>
            </center>
        </form>
    </body>
</html>) ENGINE=InnoDB DEFAULT CHARSET=latin1;

reg.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>Registration</title>

    </head>

    <body>

        <form method="post" action="registration.jsp">

            <center>

            <table border="1" width="30%" cellpadding="5">

                <thead>

                    <tr>

                        <th colspan="2">Enter Information Here</th>

                    </tr>

                </thead>

                <tbody>

                    <tr>

                        <td>First Name</td>

                        <td><input type="text" name="fname" value="" /></td>

                    </tr>

                    <tr>

                        <td>Last Name</td>

                        <td><input type="text" name="lname" value="" /></td>

                    </tr>

                    <tr>

                        <td>Email</td>

                        <td><input type="text" name="email" value="" /></td>

                    </tr>

                    <tr>

                        <td>User Name</td>

                        <td><input type="text" name="uname" value="" /></td>

                    </tr>

<tr>

                        <td>Date of Birth</td>

                        <td><input type="text" name="dob" value="" /></td>

                    </tr>

<tr>

                        <td>Gender</td>

                        <td><input type="text" name="gender" value="" /></td>

                    </tr>

<tr>

                        <td>Address</td>

                        <td><input type="text" name="address" value="" /></td>

                    </tr>

                    <tr>

                        <td>Password</td>

                        <td><input type="password" name="pass" value="" /></td>

                    </tr>

                    <tr>

                        <td><input type="submit" value="Submit" /></td>

                        <td><input type="reset" value="Reset" /></td>

                    </tr>

                    <tr>

                        <td colspan="2">Already registered!! <a href="index.jsp">Login Here</a></td>

                    </tr>

                </tbody>

            </table>

            </center>

        </form>

    </body>

</html>

registration.jsp

<%@ page import ="java.sql.*" %>

<%

    String user = request.getParameter("uname");   

    String pwd = request.getParameter("pass");

    String fname = request.getParameter("fname");

    String lname = request.getParameter("lname");

    String email = request.getParameter("email");

   String dob = request.getParameter("dob");

  String gender = request.getParameter("gender");

  String address = request.getParameter("address");

    Class.forName("com.mysql.jdbc.Driver");

    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname",

            "root", "dbpass");

    Statement st = con.createStatement();

    int i = st.executeUpdate("insert into members(first_name, last_name, email, uname, dob, gender, address, pass) values ('" + fname + "','" + lname + "','" + email + "','" + user + "'','" + dob + "'','" + gender + "'','" + address + "','" + pwd + "', CURDATE())");

    if (i > 0) {

        //session.setAttribute("userid", user);

        response.sendRedirect("welcome.jsp");

       // out.print("Registration Successfull!"+"<a href='index.jsp'>Go to Login</a>");

    } else {

        response.sendRedirect("index.jsp");

    }

%>

welcome.jsp

Registration is Successful.

Please Login Here <a href='welcome.jsp'>Go to Login</a>

login.jsp

<%@ page import ="java.sql.*" %>

<%

    String userid = request.getParameter("uname");   

    String pwd = request.getParameter("pass");

    Class.forName("com.mysql.jdbc.Driver");

    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname",

            "root", "dbpass");

    Statement st = con.createStatement();

    ResultSet rs;

    rs = st.executeQuery("select * from members where uname='" + userid + "' and pass='" + pwd + "'");

    if (rs.next()) {

        session.setAttribute("userid", userid);

        //out.println("welcome " + userid);

        //out.println("<a href='logout.jsp'>Log out</a>");

        response.sendRedirect("success.jsp");

    } else {

        out.println("Invalid password <a href='index.jsp'>try again</a>");

    }

%>

<%
if (((String)session.getAttribute("userid")).equals("admin") && (session.getAttribute("userid")!=null)) {
%>
<a href="adminpage.jsp">click here admin</a>;
<%
}
%>

success.jsp

<%

    if ((session.getAttribute("userid") == null) || (session.getAttribute("userid") == "")) {

%>

You are not logged in<br/>

<a href="index.jsp">Please Login</a>

<%} else {

%>

Welcome <%=session.getAttribute("userid")%>

<a href='logout.jsp'>Log out</a>

<%

    }

%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>USER</title>
    </head>
    <body>
        <form method="post" action="remove.jsp">
            <center>
            <table border="1" width="30%" cellpadding="3">
                <tbody>
                    <tr>
                        <td>Enter email to search</td>
                        <td><input type="text" name="email" value="" /></td>
                    </tr>

  <tr>
                        <td><input type="submit" value="Login" /></td>
                    </tr>

</tbody>
            </table>
            </center>
        </form>
    </body>
</html>

<%
  String value=request.getParameter("student_id");;
  int v=Integer.parseInt(email);
  Class.forName("com.mysql.jdbc.Driver");
  Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname","root", "dbpass");
  Statement st=conn.createStatement();
  ResultSet rs = st.executeQuery("select * from members where email='"+v+"'");
  if(rs.next()){
      %>
  <tr><td>Name: </td><td><input type="text" value="<%=rs.getString("first_name")%>"/> </td></tr>
<tr><td>Name: </td><td><input type="text" value="<%=rs.getString("last_name")%>"/> </td></tr>
<tr><td>Name: </td><td><input type="text" value="<%=rs.getString("uname")%>"/> </td></tr>
<tr><td>Name: </td><td><input type="text" value="<%=rs.getString("dob")%>"/> </td></tr>
<tr><td>Name: </td><td><input type="text" value="<%=rs.getString("gender")%>"/> </td></tr>
<tr><td>Name: </td><td><input type="text" value="<%=rs.getString("address")%>"/> </td></tr>
  <%
  }
  %>

logout.jsp

<%

session.setAttribute("userid", null);

session.invalidate();

response.sendRedirect("index.jsp");

%>

adminpage.jsp

<%

    if ((session.getAttribute("userid") == null) || (session.getAttribute("userid") == "")) {

%>

You are not logged in<br/>

<a href="index.jsp">Please Login</a>

<%} else {

%>

Welcome <%=session.getAttribute("userid")%>

<a href='logout.jsp'>Log out</a>

<%

    }

%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>Admin</title>

    </head>

    <body>

<a href="reg_admin.jsp">Add user</a>

<a href="remove.jsp">Remove user</a>

</body>

</html>

reg_admin.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Admin Registration</title>
    </head>
    <body>
        <form method="post" action="registration.jsp">
            <center>
            <table border="1" width="30%" cellpadding="5">
                <thead>
                    <tr>
                        <th colspan="2">Enter Information Here</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>First Name</td>
                        <td><input type="text" name="fname" value="" /></td>
                    </tr>
                    <tr>
                        <td>Last Name</td>
                        <td><input type="text" name="lname" value="" /></td>
                    </tr>
                    <tr>
                        <td>Email</td>
                        <td><input type="text" name="email" value="" /></td>
                    </tr>
                    <tr>
                        <td>User Name</td>
                        <td><input type="text" name="uname" value="" /></td>
                    </tr>
                    <tr>
                        <td>Password</td>
                        <td><input type="password" name="pass" value="" /></td>
                    </tr>
                    <tr>
                        <td><input type="submit" value="Submit" /></td>
                        <td><input type="reset" value="Reset" /></td>
                    </tr>

                </tbody>
            </table>
            </center>
        </form>
    </body>
</html>

remove.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Example</title>
    </head>
    <body>
        <form method="post" action="remove.jsp">
            <center>
            <table border="1" width="30%" cellpadding="3">
                <thead>
                    <tr>
                        <th colspan="2">Login Here</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>Enter User Name to remove</td>
                        <td><input type="text" name="rname" value="" /></td>
                    </tr>

  <tr>
                        <td><input type="submit" value="Login" /></td>
                    </tr>

</tbody>
            </table>
            </center>
        </form>
    </body>
</html>

<%@ page import ="java.sql.*" %>

<%

    String ruserid = request.getParameter("rname");   

    Class.forName("com.mysql.jdbc.Driver");

    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/dbname",

            "root", "dbpass");

Statement st=conn.createStatement();
int i=st.executeUpdate("DELETE FROM members WHERE uname="+ruserid);
out.println("Data Deleted Successfully!");

%>


 

Screenshots

← → c D localhost:8080/Sign!nProject/ -Login to App User ID Password

←-> CD localhost8080/SigninProject/loginservlet Login successful Hello, Admin

Add a comment
Know the answer?
Add Answer to:
Hi guys! I need some help with this Web Design mini project. Any help will be appreciated a rated...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please help!! hoose a Tool to Design Your Wireframes You may use any tool available to...

    please help!! hoose a Tool to Design Your Wireframes You may use any tool available to you that will allow you to create simple skeletal sketches of each screen or page, and to label the location of the key elements described in Part B of the assignment. You should save the sketches in one of the following formats: docx, .pptx, .sketch, .psd, .pdf, .png, .jpg, .gif, .png, or .rtf. Possible tools include Paint, PowerPoint, Word, Adobe Illustrator, Visual Studio, Visio,...

  • Please need serious and professional help! Hello! I am working on an "object oriented analysis and...

    Please need serious and professional help! Hello! I am working on an "object oriented analysis and design" Project. I would really need your sincere help in creating a vision document for this project. The Things That I require in the "vision document" is: 1. Product Overview [This section provides a high level view of the product capabilities, interfaces to other applications, and system configurations. This section usually consists of three subsections, as follows: •          Product perspective •          Product functions •         ...

  • Can somebody help me with the Use Case Diagram . I am confused of what I...

    Can somebody help me with the Use Case Diagram . I am confused of what I am suppose to do. Here are the instructions : Your team should produce a Use Case Diagram and the associated Use Case Descriptions/Narratives for all the use cases in the diagram. The resulting document should havethe “professional look” and produced by a word processor, graphics/presentation/drawing software, and/or a CASE tool (e.g., Microsoft Word, Microsoft PowerPoint, ArgoUML, Dia, Visual Paradigm, Visio, etc.). All project documentation...

  • i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due...

    i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...

  • I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter T...

    I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter Two, “Keys to Successful IT Governance,” from Roger Kroft and Guy Scalzi’s book entitled, IT Governance in Hospitals and Health Systems, please refer to the following assignment instructions below. This chapter consists of interviews with executives identifying mistakes that are made when governing healthcare information technology (IT). The chapter is broken down into subheadings listing areas of importance to understand...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT