%@ page import="java.util.*"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.sql.*"%>
<%
Date now = new Date();
long nowLong = now.getTime();
String activecode="";
String username="";
String outresult="
Kích hoạt không thành công. Vui lòng sử dụng mục liên hệ để yêu cầu hổ trợ. Trang tự chuyển trong 5 giây. Xin cảm ơn. ";
long denyFlood=0;
HttpSession denyFloodSession=denyFloodSession=request.getSession(true);
try{
activecode=request.getParameterValues("activecode")[0];
username=request.getParameterValues("username")[0];
}catch(Exception ee){activecode="";username="";}
Object get_session=denyFloodSession.getAttribute("denyFlood");
if(get_session==null){
denyFloodSession.setAttribute("denyFlood",String.valueOf(nowLong));
get_session=denyFloodSession.getAttribute("denyFlood");
}
try{denyFlood=Long.parseLong((String)get_session);}
catch(Exception ee){}
long remain=nowLong-denyFlood;
if(remain>=5000 || remain==0){
try{
String DBUrl = "jdbc:mysql://localhost:3306/tuvigl2_tuvi";
String DBUserName = "tuviuser";
String DBPassword = "EP2F469pnV6Dw3YG";
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection(DBUrl, DBUserName, DBPassword);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT user_id FROM user WHERE user_id ='"+username+"' AND activecode='"+activecode+"' AND activecode is not null AND activecode<>''");
if(rs.next()){
PreparedStatement st=con.prepareStatement("UPDATE user SET activecode='' WHERE user_id='"+username+"'");
st.executeUpdate();
stmt.close();
con.close();
outresult="
Quá trình kích hoặt đã hoàn tất. Mời bạn sử dụng các dịch vụ của tuviglobal.com. Trang tự chuyển trong 5 giây ";
}else{ //if(rs.next()){
} //if(rs.next()){
}catch(Exception ee){}
}
denyFloodSession.setAttribute("denyFlood",String.valueOf(nowLong));
out.write(outresult);
%>