Você está na página 1de 13

INRODUCTION:

1.1 Title of the project:

Login Application.

1.2 Project Category:

It is an E-Business Application.

1.3 Objective:

Authentication is the process of verification.an in e business application it plays


an important role.the customer can access the information only if he is a authorized
person.
For this purpose there are two basic functions:Registration and Login.Registration is the
process of introducing new customer to a firm.and login is the process of matching
username and password allotted to a customer after registration with the username and
password in database entered by customer at the time of registration..

This project covers the login module of an E business application.this could be applied on
various applications.

2. SYSTEM SPECIFICATIONS:

Every IT application Consists of two parts

 Front End (GUI Part)


 Back End (Database Part)

2.1 Front End Software:

Front End Software is software used to design the interface for an application
through which a user can interact with system.

We used Net beans IDE 5.5 version for designing interface for our application.

2.2 Back End Software:

1
Back End software is the software which is used to design database for an
application.

We used MySQL server 5.1 for our application as Database Management


System (DBMS).

DATABASE DESCRIPTION:

The Student table in MySQL database (namely demo) has following structure

Field Type Null Key Default Extra

name varchar(50) No NULL

username varchar(50) No NULL

password varchar(200) Yes NULL

address varchar(50)

Sample Table:

name username password address

E1 John Paul 12345 America

E2 Robin Roy 2354 America

E3 John Smith Tsdsfc India

E4 Rumel Brigenza T7u London

E5 Shelly shekh Hgjfg5r. London

E6 Ruby roy fghfg America

2
E7 Russel smith Hfghfg India

Screen shots

Database:

3
4
Project Screen 1:

Project Screen 2

When data is inserted then a dialog box is displayed.

5
Project Screen 3

When user clicks on Retrieve button then a dorm displays the record of all employees

6
Coding:

import java.awt.*;
7
import javax.swing.*;

import java.util.*;

import java.awt.event.*;

import java.sql.*;

public class login extends JFrame

JLabel l_name,l_pass;

JTextField t_name;

JPasswordField t_pass;

JButton button;

Container c;

handler handle;

database db;

login()

super("Login form");

c=getContentPane();

c.setLayout(new FlowLayout());

db=new database();

handle =new handler();

l_name=new JLabel("Username");

l_pass=new JLabel("Password");

8
t_name=new JTextField(10);

t_pass=new JPasswordField(10);

button=new JButton("Login");

button.addActionListener(handle);

c.add(l_name);

c.add(t_name);

c.add(l_pass);

c.add(t_pass);

.add(button);

setVisible(true);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setSize(400,400);

public static void main(String args[])

login sample=new login();

class handler implements ActionListener

public void actionPerformed(ActionEvent ae)

if(ae.getSource()==button)

9
char[] temp_pwd=t_pass.getPassword();

String pwd=null;

pwd=String.copyValueOf(temp_pwd);

System.out.println("Username,Pwd:"+t_name.getText()+",
"+pwd);

if(db.checkLogin(t_name.getText(), pwd))

JOptionPane.showMessageDialog(null, "You have


logged in successfully","Success",

JOptionPane.INFORMATION_MESSAGE);

else

JOptionPane.showMessageDialog(null, "Login
failed!","Failed!!",JOptionPane.ERROR_MESSAGE);

class database

10
final Vector columnNames = new Vector();

Connection con;

final Vector data = new Vector();

PreparedStatement pst;

ResultSet rs;

database()

try

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

con=DriverManager.getConnection("jdbc:mysql://localhost:3306
login","root","root");

pst=con.prepareStatement("select * from biodata where


username=? and password=?");

catch (Exception e)

System.out.println(e);

public Boolean checkLogin(String uname,String pwd)

11
try

pst.setString(1, uname);

pst.setString(2, pwd);

rs=pst.executeQuery();

ResultSetMetaData md = rs.getMetaData();

int columns = md.getColumnCount();

for (int i = 1; i <= columns; i++)

columnNames.addElement( md.getColumnName(i) );

while (rs.next())

Vector row = new Vector(columns);

for (int i = 1; i <= columns; i++)

row.addElement( rs.getObject(i) );

data.addElement( row );

JFrame tab=new JFrame();

JTable table = new JTable(data, columnNames);

JScrollPane scrollPane = new JScrollPane( table );

12
tab.add( scrollPane );

tab.setVisible(true);

tab.setSize(500,500);

return true;

catch (Exception e)

System.out.println("error while validating"+e);

return false;

13

Você também pode gostar