📄 newsmain_jsp.java
字号:
out.write(' ');
//*------------------------------------------------------------------------------------------------------
//+ DB 관련 변수
//-------------------------------------------------------------------------------------------------------*/
PreparedStatement pstmt = null;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String query1 = null;
ResultSet pageRs = null;
try
{
/*------------------------------------------------------------------------------------------------
* DB 커넥션
-------------------------------------------------------------------------------------------------*/
String SYSTEM_PARAMETER_SET = "?mphone="+request.getParameter("mphone")+"&gphone="+request.getParameter("mphone");
String SYSTEM_PHONE_NUMBER = request.getParameter("mphone");
//
//
if(IS_SYSTEM_CHECK)
{
if( ! IS_TESTER_MODE )
{
response.sendRedirect(url_path+"/system_notice.jsp"+SYSTEM_PARAMETER_SET);
return;
}
}
//
//
con = com.entaz.lib.db.DBConnector.getConnection("mugeta");
if( con == null )
{
response.sendRedirect(url_path+"/system_notice2.jsp"+SYSTEM_PARAMETER_SET);
return;
}
//
//
if( IS_TESTER_MODE )
{
boolean isTester = com.entaz.lib.db.DBConnector.chkTester( con, SYSTEM_PHONE_NUMBER );
if( ! isTester )
{
response.sendRedirect(url_path+"/system_notice.jsp"+SYSTEM_PARAMETER_SET);
return;
}
}
//
//
boolean isBlackUser = com.entaz.lib.db.DBConnector.chkBlackList( con, SYSTEM_PHONE_NUMBER );
if( isBlackUser )
{
response.sendRedirect(url_path+"/bad_member.jsp"+SYSTEM_PARAMETER_SET);
return;
}
out.write('\r');
out.write('\n');
out.write(' ');
out.write("<!-------------------------------------------------------------\r\n");
out.write("* @ name: bgColor.jsp\r\n");
out.write("* @ func: Change the background color by level\r\n");
out.write("\t\t give prize to user who get the right level \r\n");
out.write("* @ Author : ranxu \r\n");
out.write("* @ date :2008-06-27\r\n");
out.write("-------------------------------------------------------------->\r\n");
String bgSql = "";
String prizeSql = "";
long cumulatedExpNow = 0;
long cumulatedExp = 0;
int point_take = 0;
int point_hit = 0;
int level = 0;
int neededExp = 0;
String mainBgColor = "#ffb9b3"; //zhu ye mian bei jing yan se
String mainBgColorName = "";
String mainFontColor = "";
String contentBgColor = "";
String titleColor = ""; //biao ti lan
String titleFontColorY = ""; //wei xuan zhong
String pageBgColor = "";
String pageFNFontColor = "";
String pageFontColorY = "";
String pageFontColorN = "";
String partitionColor = "";
String btnFontColor = "";
int prize = 0;
int re = -1;
/*------------------------------------------------------------------------------------------------
* SELECT point_take and point_hit in order to get now cumulated Experence
-------------------------------------------------------------------------------------------------*/
bgSql = " SELECT point_take,point_hit FROM gt_nslevelset WHERE phonenum=?";
pstmt = con.prepareStatement(bgSql);
pstmt.setLong(1,getLong(gphone));
rs = pstmt.executeQuery();
while(rs.next()){
point_take = rs.getInt("point_take");
point_hit = rs.getInt("point_hit");
}
rs.close();
pstmt.close();
//get now cumulated Experence
cumulatedExpNow = point_take*2+point_hit*1;
/*------------------------------------------------------------------------------------------------
* get the user's level , bgcolor and so on
-------------------------------------------------------------------------------------------------*/
bgSql=" SELECT TOP 1 * FROM gt_nslevel WHERE cumulatedExp<=? ORDER BY cumulatedExp DESC";
//bgSql="SELECT top 1 * FROM gt_nslevel WHERE cumulatedExp>=? ";
pstmt = con.prepareStatement(bgSql);
pstmt.setLong(1,cumulatedExpNow);
rs = pstmt.executeQuery();
while(rs.next()){
level = rs.getInt("level");
neededExp = rs.getInt("neededExp");
cumulatedExp = rs.getInt("cumulatedExp");
mainBgColor=rs.getString("mainBgColor");
mainBgColorName=rs.getString("mainBgColorName");
mainFontColor=rs.getString("mainFontColor");
contentBgColor=rs.getString("contentBgColor");
titleColor=rs.getString("titleColor");
titleFontColorY=rs.getString("titleFontColorY");
pageBgColor=rs.getString("pageBgColor");
pageFNFontColor=rs.getString("pageFNFontColor");
pageFontColorY=rs.getString("pageFontColorY");
pageFontColorN=rs.getString("pageFontColorN");
partitionColor=rs.getString("partitionColor");
btnFontColor=rs.getString("btnFontColor");
prize = rs.getInt("prize");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* give prize to user when he got the right level
-------------------------------------------------------------------------------------------------*/
if(prize!=0){
prizeSql="SELECT * FROM gt_moneybook WHERE phonenum=? AND moneybook_flag=? AND moneybook_clover=?";
pstmt=con.prepareStatement(prizeSql);
pstmt.setLong(1,getLong(gphone));
pstmt.setInt(2,1);
pstmt.setLong(3,prize);
rs = pstmt.executeQuery();
if(rs.next()){
}else{
prizeSql="EXEC gt_money_input ?,?,?";
pstmt = con.prepareStatement(prizeSql);
pstmt.setLong(1,getLong(gphone));
pstmt.setString(2,"");
pstmt.setLong(3,prize);
re = pstmt.executeUpdate();
if(re == -1){
return;
}
pstmt.close();
}
rs.close();
pstmt.close();
}
if (neededExp == 0)
fLevel = 1;
else
fLevel = (long)(((float)(cumulatedExpNow - cumulatedExp)) / (float)neededExp * 10) + 1;
imgFile = img_path + "images/news/010_"+ fLevel +".png";
String sql = "SELECT NICKNAME FROM GT_USER_INFO WITH (READUNCOMMITTED) WHERE PHONENUM = '" + gphone + "'";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
nickName = rs.getString("NICKNAME");
}
rs.close();
pstmt.close();
// 기분
sql = "SELECT COUNT(*) FROM GT_NsMood WITH (READUNCOMMITTED) WHERE PHONENUM = " + Long.parseLong(gphone);
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
count = rs.getInt(1);
}
rs.close();
pstmt.close();
if (count > 0)
{
String strState = "";
sql = "SELECT TOP 1 STATE FROM GT_NsMood WITH (READUNCOMMITTED) WHERE PHONENUM =" + Long.parseLong(gphone) + " ORDER BY REGDATE DESC";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
iTodayState = rs.getInt(1);
rs.close();
pstmt.close();
if (iTodayState == 1)
strState = "눈물이 주룩주룩";
else if (iTodayState == 2)
strState = "위로해줘요";
else if (iTodayState == 3)
strState = "뜨뜻미지근";
else if (iTodayState == 4)
strState = "유쾌통쾌";
else if (iTodayState == 5)
strState = "행목만땅";
strTodayState = "현재 "+ nickName +"님은 </font><b><a href='"+url_path+"/news/feelStatus.jsp?mphone="+mphone+"&gphone="+gphone+"'><font color='"+ mainFontColor + "' size='3'>"+ strState +"</font></a></b><font color='#928279' size='3'>상태입니다~☆";
}
}
else
{
if (mphone.equals(gphone))
strTodayState = "<a href='"+url_path+"/news/feelStatus.jsp?mphone="+mphone+"&gphone="+gphone+"'>기분을 등록해주세요.</a>";
else
strTodayState = "";
}
// 말풍선 및 프로필
sql = "SELECT COUNT(*) FROM GT_NsProfile WITH (READUNCOMMITTED) WHERE PHONENUM = " + Long.parseLong(gphone) + " AND CONVERT(VARCHAR(20), regdate, 102) = CONVERT(VARCHAR(20), GETDATE(), 102)";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
cProfileCount = rs.getInt(1);
}
if (cProfileCount > 0)
{
boolState = true;
}
else
{
boolState = false;
}
rs.close();
pstmt.close();
sql = "SELECT TOP 1 idx, toolTip, toDo, motto, friend, wish, interest, ";
sql = sql + " food, music, agony, lookMan, fault, ToDorReCnt, ";
sql = sql + " mottoReCnt, friendReCnt, wishReCnt, interestReCnt, ";
sql = sql + " foodReCnt, musicReCnt, agonyReCnt, lookManReCnt, ";
sql = sql + " faultReCnt, totCnt, face FROM GT_NsProfile WITH (READUNCOMMITTED) ";
sql = sql + " WHERE PHONENUM = " + Long.parseLong(gphone) + " ORDER BY REGDATE DESC";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
iIdx = rs.getInt("idx");
strToolTip = rs.getString("toolTip").trim();
strToDo = rs.getString("toDo").trim();
strMotto = rs.getString("motto").trim();
strFriend = rs.getString("friend").trim();
strWish = rs.getString("wish").trim();
strInterest = rs.getString("interest").trim();
strFood = rs.getString("food").trim();
strMusic = rs.getString("music").trim();
strAgony = rs.getString("agony").trim();
strLookMan = rs.getString("lookMan").trim();
strFault = rs.getString("fault").trim();
iToDorReCnt = rs.getInt("ToDorReCnt");
iMottoReCnt = rs.getInt("mottoReCnt");
iFriendReCnt = rs.getInt("friendReCnt");
iWishReCnt = rs.getInt("wishReCnt");
iInterestReCnt = rs.getInt("interestReCnt");
iFoodReCnt = rs.getInt("foodReCnt");
iMusicReCnt = rs.getInt("musicReCnt");
iAgonyReCnt = rs.getInt("agonyReCnt");
iLookManReCnt = rs.getInt("lookManReCnt");
iFaultReCnt = rs.getInt("faultReCnt");
iTotCnt = rs.getInt("totCnt");
iFace = rs.getInt("face") == 0 ? 1 : rs.getInt("face");
}
rs.close();
pstmt.close();
if (strToolTip.equals(""))
{
strToolTip = "등록된 뉴스 프로필이<br>없습니다.";
}
/*else
{
strToolTip = "안녕<br>" + strToolTip + "<br>하앍~";
}
if (strToDo.equals("") && strMotto.equals("") && strFriend.equals("") && strWish.equals("")
&& strInterest.equals("") && strFood.equals("") && strMusic.equals("") && strAgony.equals("")
&& strLookMan.equals("") && strFault.equals(""))
boolState = false;
else
boolState = true;*/
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<title></title>\r\n");
out.write("<link href=\"http://entaz.mugeta.com/client/mugeta_v2_test/web/user/mobile.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("\t\r\n");
out.write("<table width=\"240\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write("\t<!-- 박스 시작 -->\r\n");
out.write("\t<tr>\r\n");
out.write("\t\t<td>\t\t\r\n");
out.write("\t\t\t<table width=\"240\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"");
out.print(mainBgColor);
out.write("\">\r\n");
out.write("\t\t\t\t<tr height=\"20\">\r\n");
out.write("\t\t\t\t\t<td width=\"3\"></td>\r\n");
out.write("\t\t\t\t\t<td align=\"center\"><font color=\"#ffffff\">★ ");
out.print(nickName);
out.write("</font>님의 뉴스 <font color=\"#ffffff\">★</font></td>\r\n");
out.write("\t\t\t\t\t<td width=\"3\"></td>\r\n");
out.write("\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t");
if (!strTodayState.equals("")) {
out.write("\r\n");
out.write("\t\t\t\t<tr height=\"20\">\r\n");
out.write("\t\t\t\t\t<td width=\"3\"></td>\r\n");
out.write("\t\t\t\t\t<td bgcolor=\"#fffad2\" align=\"center\">\r\n");
out.write("\t\t\t\t\t\t<font color=\"#928279\" size=\"3\">");
out.print(strTodayState);
out.write("</font>\r\n");
out.write("\t\t\t\t\t</td>\r\n");
out.write("\t\t\t\t\t<td width=\"3\"></td>\r\n");
out.write("\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t");
}
out.write("\r\n");
out.write("\t\t\t\t<tr height=\"5\">\r\n");
out.write("\t\t\t\t\t<td width=\"3\"></td>\r\n");
out.write("\t\t\t\t\t<td bgcolor=\"#ffffff\"></td>\r\n");
out.write("\t\t\t\t\t<td width=\"3\"></td>\r\n");
out.write("\t\t\t\t</tr>\r\n");
out.write("\t\t\t</table>\r\n");
out.write("\t\t</td>\r\n");
out.write("\t</tr>\r\n");
out.write("\t<tr>\r\n");
out.write("\t\t<td>\r\n");
out.write("\t\t\t<table width=\"240\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write("\t\t\t\t<tr>\r\n");
out.write("\t\t\t\t\t<td width=\"3\" bgcolor=\"");
out.print(mainBgColor);
out.write("\"></td>\r\n");
out.write("\t\t\t\t\t<td width=\"5\"></td>\r\n");
out.write("\t\t\t\t\t<td width=\"50\" height=\"56\">\r\n");
out.write("\t\t\t\t\t\t<!-- 아바타 이미지 시작 -->\r\n");
out.write("\t\t\t\t\t\t<table bgcolor=\"#ffede3\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write("\t\t\t\t\t\t\t<tr height=\"1\">\r\n");
out.write("\t\t\t\t\t\t\t\t<td colspan=\"3\"></td>\r\n");
out.write("\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t\t<tr height=\"54\">\r\n");
out.write("\t\t\t\t\t\t\t\t<td width=\"1\"></td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td align=\"center\"><img src=\"");
out.print(ava_path);
out.write("display_thumb.jsp?mphone=");
out.print(mphone);
out.write("&gphone=");
out.print(gphone);
out.write("&face=");
out.print(iFace);
out.write("\" width=\"48\" height=\"54\" border=\"0\"></td>\r\n");
out.write("\t\t\t\t\t\t\t\t<td width=\"1\"></td>\r\n");
out.write("\t\t\t\t\t\t\t</tr>\r\n");
out.write("\t\t\t\t\t\t\t<tr height=\"1\">\r\n");
out.write("\t\t\t\t\t\t\t\t<td colspan=\"3\"></td>\r\n");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -