Source Code: Distributed Datamining in Credit Card Fraud Detection Source Code
Source Code: Distributed Datamining in Credit Card Fraud Detection Source Code
SOURCE CODE
Login Handler
/*
* loginservlet.java
*
* Created on Oct 3, 2007, 11:31:53 AM
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author Administrator
*/
public class LoginHandler extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and
<code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String userid = request.getParameter("userid");
String password = request.getParameter("password");
64
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
String target="fail.jsp";
Dao dao = new Dao();
if(dao.logincheck(userid, password)){
target = "adminpanel.jsp";
}
else
{
target = "fail.jsp";
}
RequestDispatcher rd =
request.getRequestDispatcher(target);
rd.forward(request, response);
/* TODO output your page here
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet loginservlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet loginservlet at " +
request.getContextPath () + "</h1>");
out.println("</body>");
out.println("</html>");
*/
out.close();
}
65
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
}*/
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}
User Beans
/*
* UserBean.java
*
* Created on Oct 3, 2007, 12:24:39 PM
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
66
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
*/
public class UserBean {
private String username;
private String password;
private String role;
public UserBean() {
}
public void setUserName(String username){
this.username = username;
}
public void setPassword(String password){
this.password = password;
}
public void setRole(String role){
this.role = role;
}
public String getUserName(){
return username;
}
public String getPassword() {
return password;
}
public String getRole(){
return role;
}
}
Administrator
/*
* dao.java
*
* Created on Oct 3, 2007, 11:33:50 AM
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
67
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
import java.sql.*;
/**
*
* @author Administrator
*/
public class Dao {
private String url="jdbc:oracle:thin:@localhost:1521:orcl";
private String driver="oracle.jdbc.driver.OracleDriver";
private String userid="ccdata";
private String password="ccdata";
private Connection con=null;
private ResultSet rs;
private Statement stmt;
public Dao() {
try
{
Class.forName(driver);
con = DriverManager.getConnection(url,userid,password);
}
catch(ClassNotFoundException cnfe){
cnfe.printStackTrace();
}
catch(SQLException sqle){
sqle.printStackTrace();
}
}
public boolean logincheck(String user, String password){
String sql = "Select * from users where ID='"+user+"' and
password='"+password+"' and role='admin'";
System.out.println(sql);
boolean flag=false;
try
{
stmt = con.createStatement();
rs = stmt.executeQuery(sql);
68
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
if(rs.next()){
flag = true;
}
else
flag = false;
}
catch(SQLException sqle){
sqle.printStackTrace();
}
return flag;
}
Index
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>template: home</title>
<meta http-equiv="content-type" content="text/html; charset=iso-
8859-1" />
</head>
<body>
<div id="main">
<div id="header">
69
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
70
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
71
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
72
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
<h2>Bold Text</h2>
<p><strong>this is an example of bold text</strong></p>
<h2>Italics</h2>
<p><i>this is an example of italic text</i></p>
<h2>Links</h2>
<p><a href="index.html">this is an example link</a></p>
<h2>Block Quotes</h2>
<blockquote>
<p>
Some blockquote text. Lorem ipsum dolor sit amet,
consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.
</p>
</blockquote>
<h2>Unordered Lists</h2>
<ul>
<li>list item 1</li>
<li>list item 2</li>
</ul>
<br />
<h2>Ordered Lists</h2>
<ol>
<li>list item 1</li>
<li>list item 2</li>
</ol>
<br />
<h2>Images</h2>
<p>images can be placed on the left, in the center or on the
right.</p>
<span class="left"><img src="style/graphic.jpg" alt="example
graphic" /></span>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud
73
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
74
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
75
Sri Sai college of IT & Management
Distributed DataMining in Credit Card Fraud Detection Source Code
76
Sri Sai college of IT & Management