1일글쓰기1회제한에 포인트를지급하고싶은데요

만들구있는데 포인트지급까진 완료됬고 한계정당 시간 24시간기준으로 포인트를 1일 1회 지급하고싶은데 어떻게해야하나요..

 

 

<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import ="java.sql.*,java.util.*,java.util.Calendar" %>
<%request.setCharacterEncoding("euc-kr"); %>
<%response.setCharacterEncoding("euc-kr");

String unick=(String)session.getAttribute("usernick") ;
if (unick==null) {
//("세션이 종료되었습니다.");
response.sendRedirect("Home.jsp");
}
String upoint = (String)session.getAttribute("userpoint");
String uid = (String)session.getAttribute("userid");

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<script type="text/javascript">

function send(){
document.reply.method = "post"
document.reply.action = "reply_output.jsp";
document.reply.submit();

}

</script>
</head>

<center><b><img src=image/check.png></b></center>
<body>
<p><p>

<fieldset style="border-color: #8f0100;">
<form action=reply_output.jsp name=reply>
<table width="600" height="50" border=0 align="center" style="border-collapse:collapse; border:4; solid ;border-color:#8F0100;">
<tr>
<input type = hidden value=<%=upoint %> name=upoint>
<input type = hidden value=<%=uid %> name=uid>

<td width="100" align=center><img src=image/memo.png width=80 heigth=80></td>
<td width="400"><input type="text" size="50" name=des style="border-color:#8F0100">
<input type=hidden value=<%=unick %> name=nick>
</td>
<td width="100" align=center><input type=image src=image/button.png width=50 height=26 action=reply_output.jsp" onclick="alert('하루에한번투표가능합니다.')">
</tr>
</form>

<div>

<%


Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin://localhost:1521/ORCL";
Connection conn = DriverManager.getConnection(url,"SCOTT","tiger");
Statement stmt = conn.createStatement();
ResultSet rs1=stmt.executeQuery("select count(*) from reply");
rs1.next();
int total=rs1.getInt(1);
//현재 페이지
int a = 0;
int nowPage = 0;
int nowBlock = 0; //현재 블럭+
int totalRecord = total;
int numPerPage = 10;
int pagePerBlock = 15;
int totalPage = 0;
int totalBlock = 0;
int beginPerPage = 0;
if(request.getParameter("nowPage")!=null){
nowPage = Integer.parseInt(request.getParameter("nowPage"));
nowBlock = Integer.parseInt(request.getParameter("nowBlock"));
}
beginPerPage = nowPage * numPerPage;

totalPage =(int)Math.ceil((double)totalRecord / numPerPage);
totalBlock =(int)Math.ceil((double)totalPage / pagePerBlock);
%>

<%
PreparedStatement pstmt2 = null;
// String strSQL ="select name,contents,wdate from reply where news_num=?";
//String strSQL ="select num,nick,des,TO_CHAR(wdate,'YY-MM-DD HH24:MI') wdate from reply where num between "+beginPerPage+" and "+(beginPerPage+numPerPage)+" order by num desc";
String strSQL ="select num,nick,des,TO_CHAR(wdate,'YY-MM-DD HH24:MI') wdate from reply order by num desc";
pstmt2 = conn.prepareStatement(strSQL);
//pstmt2.setInt(1, num);

ResultSet rs=pstmt2.executeQuery();
%>
<%
int cnt=0;
while(rs.next())
{

if(cnt==beginPerPage) {
for (int i = beginPerPage;i < (beginPerPage+numPerPage); i++) {
if (i==totalRecord) break;
out.println("<table border=0 width=600 align=center>");
out.println("<tr><td align='center'width=95>");
out.println(rs.getString("nick")+"</td><td width=400 >");
out.println(rs.getString("des")+"</td><font size=1><b><td align=center width=105>");
out.println(rs.getString("wdate")+"</td></tr><b></font>");
rs.next();
cnt +=1;
}
}
cnt +=1;
}
%>
</table><br><br></form></fieldset>
<%
%>

<!-- 검색폼 끝 -->
<table width="650" border="0" align=center>
<tr>
<td><br><br></td>
</tr>
<tr>
<!--페이징 및 블럭 처리 시작 -->

<td align="center" > Go to Page

<%
if(totalRecord !=0){ %>
<!-- 이전 블럭 -->
<% if (nowBlock > 0) {%>
<a href="Reply.jsp?nowBlock=<%=nowBlock - 1 %>&nowPage=<%=((nowBlock - 1) *
pagePerBlock)%>">
[이전 <%=pagePerBlock %>]</a>
<%}%>

<%
for (int i = 0; i < pagePerBlock; i++) { %>
<a href="Reply.jsp?nowBlock=<%=nowBlock %>&nowPage=<%=(nowBlock*pagePerBlock) + i %>">
[<%=(nowBlock * pagePerBlock) + i + 1 %>]</a>

<% if ((nowBlock * pagePerBlock) + i + 1 == totalPage) break; %>

<!-- 다음 블럭 -->
<% if(totalBlock>nowBlock+1){%>
<a href="Reply.jsp?nowBlock=<%=nowBlock+1 %>&nowPage=<%=(nowBlock+1)*pagePerBlock %>">
[다음 <%=pagePerBlock %>]</a>
<%}%>

<%}
}else{
out.println("등록된 게시물이 없습니다.");
}
%>
</td>
</table>
<br>

<table align=center border="0" width="80%">
<tr>
<td align="center">Total : <%=totalRecord%> Articles(<font color=#8F0100>
<%=nowPage+1%>/<%=totalPage%>Pages</font>)</td>
</tr>
</table>

<Table align=center>
<form name="reply" method="post">
<input type="hidden" name="num" value="">
<input type="hidden" name="nowPage" value="<%=nowPage%>">
<input type="hidden" name="nowBlock" value="<%=nowBlock%>">
</form>
<form name="reply" method="post">
<input type="hidden" name="reload" value="true">
<input type="hidden" name="nowPage" value="0">
<input type="hidden" name="nowBlock" value="0">
</form>
</table>
<%
pstmt2.close();
conn.close();
%>
</div>
 --------------------------------------------------------------------------------------------------

<%-- <%@ page language="java" contentType="text/html; charset=EUC-KR" --%>
<%--  pageEncoding="EUC-KR"%> --%>
<%-- <%@page import="java.sql.*,java.util.*,java.util.Calendar"%> --%>
<%-- <% --%>
//  request.setCharacterEncoding("euc-kr");
<%-- %> --%>
<%-- <% --%>
//  response.setCharacterEncoding("euc-kr");
<%-- %> --%>
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -->
<!-- <html> -->
<!-- <head>  -->
<!-- <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> -->
<%-- <% --%>
//  String num = request.getParameter("num");
//  String nick = request.getParameter("nick");
//  String des = request.getParameter("des");
//  String point = request.getParameter("upoint");
//  String id = request.getParameter("uid");

//  Class.forName("oracle.jdbc.driver.OracleDriver");
//  String url = "jdbc:oracle:thin://localhost:1521/ORCL";
//  Connection conn = DriverManager
//    .getConnection(url, "SCOTT", "tiger");

//  PreparedStatement pstmt2 = null;

 
//  ResultSet rs = null;

//  String strSQL = "INSERT INTO reply(num,nick,des,wdate)";
//  strSQL = strSQL + "VALUES(reply_seq.nextval,?,?,sysdate)";
//  pstmt2 = conn.prepareStatement(strSQL);
//  pstmt2.setString(1, nick);
//  pstmt2.setString(2, des);
//  rs = pstmt2.executeQuery();
 
//  rs.next();
 
//  strSQL ="update member set point=?+50 where id=?";
//  pstmt2 = conn.prepareStatement(strSQL);
//  pstmt2.setString(1, point);
//  pstmt2.setString(2, id);
//  pstmt2.executeUpdate();
 
//  rs.close();
//  pstmt2.close();
//  conn.close();
//  response.sendRedirect("Reply.jsp");

<%-- %> --%>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
 pageEncoding="EUC-KR"%>
<%@page import="java.sql.*,java.util.*,java.util.Calendar"%>
<%
 request.setCharacterEncoding("euc-kr");
%>
<%
 response.setCharacterEncoding("euc-kr");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
 <% 
  
 String num = request.getParameter("num");
 String nick = request.getParameter("nick");
 String des = request.getParameter("des");
 String id = request.getParameter("uid");

 Class.forName("oracle.jdbc.driver.OracleDriver");
 String url = "jdbc:oracle:thin://localhost:1521/ORCL";
 Connection conn = DriverManager
   .getConnection(url, "SCOTT", "tiger");

 PreparedStatement pstmt2 = null;

 


 String strSQL = "INSERT INTO reply(num,nick,des,wdate)";
 strSQL = strSQL + "VALUES(reply_seq.nextval,?,?,sysdate)";
 pstmt2 = conn.prepareStatement(strSQL);
 pstmt2.setString(1, nick);
 pstmt2.setString(2, des);
 pstmt2.executeUpdate();
  
 
 strSQL ="update member set point=point+50 where id=?";
 pstmt2 = conn.prepareStatement(strSQL);
 pstmt2.setString(1, id);
 pstmt2.executeUpdate();

 
 pstmt2.close();
 conn.close();
 response.sendRedirect("Reply.jsp");
 

%>

​ 

 

|

댓글 1개

1) cron 으로 jsp 을 따로 만드셔서 돌리시거나
2) jsp 만 돌리시는 상황이라 http://jtheory.com/jdring.html 과 같은 것을 이용해서
스케줄링하시는것도 방법인것 같습니다..

jsp 로 구현하신 상황이시라 1번 방식 추천
댓글을 작성하시려면 로그인이 필요합니다. 로그인

프로그램

태그 필터 (최대 3개) 전체 개발자 소스 기타 mysql 팁자료실 javascript php linux flash 정규표현식 jquery node.js mobile 웹서버 os 프로그램 강좌 썸네일 이미지관련 도로명주소 그누보드5 기획자 견적서 계약서 기획서 마케팅 제안서 seo 통계 서식 통계자료 퍼블리셔 html css 반응형 웹접근성 퍼블리싱 표준화 반응형웹 홈페이지기초 부트스트랩 angularjs 포럼 스크린리더 센스리더 개발자톡 개발자팁 퍼블리셔톡 퍼블리셔팁 기획자톡 기획자팁 프로그램강좌 퍼블리싱강좌
+
제목 글쓴이 날짜 조회
10년 전 조회 1,250
10년 전 조회 1,200
10년 전 조회 1,667
10년 전 조회 1,098
10년 전 조회 1,358
10년 전 조회 1,437
10년 전 조회 1,822
10년 전 조회 1,581
10년 전 조회 2,414
10년 전 조회 1,831
10년 전 조회 1,936
10년 전 조회 991
10년 전 조회 1,269
10년 전 조회 1,241
10년 전 조회 891
10년 전 조회 672
10년 전 조회 877
10년 전 조회 1,583
10년 전 조회 914
10년 전 조회 1,826
10년 전 조회 3,586
10년 전 조회 1,403
10년 전 조회 1,261
10년 전 조회 1,211
10년 전 조회 1,186
10년 전 조회 854
10년 전 조회 2,050
10년 전 조회 776
10년 전 조회 1,212
10년 전 조회 1,305
10년 전 조회 1,383
10년 전 조회 2,409
10년 전 조회 1,110
10년 전 조회 1,577
11년 전 조회 988
11년 전 조회 1,000
11년 전 조회 1,865
11년 전 조회 1,285
11년 전 조회 1,082
11년 전 조회 1,484
11년 전 조회 829
11년 전 조회 1,287
11년 전 조회 1,409
11년 전 조회 4,481
11년 전 조회 1,144
11년 전 조회 877
11년 전 조회 3,403
11년 전 조회 1,371
11년 전 조회 1,138
11년 전 조회 721
11년 전 조회 727
11년 전 조회 1,639
11년 전 조회 3,997
11년 전 조회 2,148
11년 전 조회 1,002
11년 전 조회 528
11년 전 조회 1,456
11년 전 조회 1,495
11년 전 조회 3,377
11년 전 조회 1,172
11년 전 조회 2,954
11년 전 조회 2,104
11년 전 조회 835
11년 전 조회 1,116
11년 전 조회 2,640
11년 전 조회 1,213
11년 전 조회 1,429
11년 전 조회 2,329
11년 전 조회 2,124
11년 전 조회 889
11년 전 조회 1,036
11년 전 조회 3,349
11년 전 조회 1,301
11년 전 조회 1,367
11년 전 조회 1,034
11년 전 조회 640
11년 전 조회 878
11년 전 조회 1,234
11년 전 조회 2,592
11년 전 조회 1,151
11년 전 조회 1,483
11년 전 조회 1,153
11년 전 조회 926
11년 전 조회 4,015
11년 전 조회 992
11년 전 조회 1,231
11년 전 조회 887
11년 전 조회 1,276
11년 전 조회 946
11년 전 조회 540
11년 전 조회 650
11년 전 조회 1,117
11년 전 조회 1,190
11년 전 조회 1,193
11년 전 조회 1,241
11년 전 조회 847
11년 전 조회 941
11년 전 조회 3,720
11년 전 조회 1,548
11년 전 조회 494
🐛 버그신고