Skip to content

Commit

Permalink
Temp Backup added
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyadip007 committed Dec 2, 2019
1 parent 94e645e commit c9172fc
Show file tree
Hide file tree
Showing 111 changed files with 6,450 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package Controller;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*
* @author Soumyadip Chowdhury
*
*/
@WebServlet("/addevents")
public class GetLoc extends HttpServlet {
private static final long serialVersionUID = 1L;



protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub

String name=request.getParameter("name");
String start=request.getParameter("sdate");
String end=request.getParameter("edate");
String venue=request.getParameter("venue");
String des=request.getParameter("des");

String fee=request.getParameter("fee");
String link=request.getParameter("link");
try {


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

ServletContext ct=getServletContext();

Connection con=(Connection) DriverManager.getConnection(ct.getInitParameter("path"),ct.getInitParameter("user"),ct.getInitParameter("pass"));

// Connection con=(Connection) DriverManager.getConnection("jdbc:mysql://node12654-getsaved.cloudjiffy.net/hackathon","root","THHrio35634");

PreparedStatement st=con.prepareStatement("INSERT INTO event(name,start,end,venue,des,fee,link) values(?,?,?,?,?,?,?)");

st.setString(1,name);
st.setString(2,start);
st.setString(3,end);
st.setString(4,venue);
st.setString(5,des);

st.setString(6,fee);
st.setString(7,link);

int i=st.executeUpdate();

st=con.prepareStatement("INSERT INTO allevents(name,start,end,venue) values(?,?,?,?)");

st.setString(1,name);
st.setString(2,start);
st.setString(3,end);
st.setString(4,venue);


st.executeUpdate();

} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}






response.getWriter().append("Served at: ").append(request.getContextPath());
//response.sendRedirect("https://www.latlong.net/c/?lat="+latt+"&long="+longi);
// https://www.google.co.in/maps/@22.5601086,88.4904909,21z

response.sendRedirect("adminhome.jsp");
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package Controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.sun.org.apache.xpath.internal.operations.And;

import Dao.Dao;


/**
* Servlet implementation class Login
*/
public class Login extends HttpServlet {
private static final long serialVersionUID = 1L;


protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String user =(String)request.getParameter("user");
String pass =(String)request.getParameter("pass");
String user1="Wrong Email/Password";
Dao obj=new Dao();
int j=obj.log(user,pass);
if(j==1)
{
HttpSession session=request.getSession();
session.setAttribute("username",user);
try {

response.sendRedirect("Home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else{
try {

HttpSession session=request.getSession();
session.setAttribute("user",user1);
response.sendRedirect("Login.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package Controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.sun.org.apache.xpath.internal.operations.And;

import Dao.Dao;


/**
* Servlet implementation class Login
*/
public class Login extends HttpServlet {
private static final long serialVersionUID = 1L;


protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String user =(String)request.getParameter("user");
String pass =(String)request.getParameter("pass");
String user1="Wrong Email/Password";
Dao obj=new Dao();
int j=obj.log(user,pass);
if(j==1)
{
HttpSession session=request.getSession();
session.setAttribute("username",user);
try {

response.sendRedirect("Home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else{
try {

HttpSession session=request.getSession();
session.setAttribute("user",user1);
response.sendRedirect("Login.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package Controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.sun.org.apache.xpath.internal.operations.And;

import Dao.Dao;


/**
* Servlet implementation class Login
*/
public class Login extends HttpServlet {
private static final long serialVersionUID = 1L;


protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String user =(String)request.getParameter("user");
String pass =(String)request.getParameter("pass");
String user1="Wrong Email/Password";
Dao obj=new Dao();
int j=obj.log(user,pass);
if(j==1)
{
HttpSession session=request.getSession();
session.setAttribute("username",user);
try {

response.sendRedirect("Home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else{
try {

HttpSession session=request.getSession();
session.setAttribute("user",user1);
response.sendRedirect("Login.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package Controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
* Servlet implementation class Logout
*/
@WebServlet("/Logout")
public class Logout extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


HttpSession session=request.getSession();

session.removeAttribute("user");
session.invalidate();

try {
response.sendRedirect("Home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package Controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
* Servlet implementation class Logout
*/
@WebServlet("/Logout")
public class Logout extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


HttpSession session=request.getSession();

session.removeAttribute("user");
session.invalidate();

try {
response.sendRedirect("Home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package Controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
* Servlet implementation class Logout
*/
@WebServlet("/Logout")
public class Logout extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


HttpSession session=request.getSession();

session.removeAttribute("user");
session.invalidate();

try {
response.sendRedirect("Home.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Loading

0 comments on commit c9172fc

Please sign in to comment.