fork download
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package jmb_g1;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.InputStreamReader;
  10. import java.util.ArrayList;
  11.  
  12. import org.apache.http.HttpEntity;
  13. import org.apache.http.HttpResponse;
  14. import org.apache.http.NameValuePair;
  15. import org.apache.http.client.HttpClient;
  16. import org.apache.http.client.entity.UrlEncodedFormEntity;
  17. import org.apache.http.client.methods.HttpPost;
  18. import org.apache.http.impl.client.DefaultHttpClient;
  19. import org.apache.http.message.BasicNameValuePair;
  20. import org.jsoup.Jsoup;
  21. import org.jsoup.nodes.Document;
  22. import org.jsoup.select.Elements;
  23.  
  24. /**
  25.  *
  26.  *
  27.  */
  28. public class MemberModel {
  29.  
  30. public static void memberCheck(String name, String password)
  31. throws Exception {
  32. try {
  33. HttpClient httpclient = new DefaultHttpClient();
  34. HttpPost httpPost = new HttpPost(
  35. "https://d...content-available-to-author-only...e.com/join/member_check.php");
  36. java.util.List<NameValuePair> params = new ArrayList<NameValuePair>();
  37. params.add(new BasicNameValuePair("user_id", name));
  38. params.add(new BasicNameValuePair("password", password));
  39. params.add(new BasicNameValuePair("s_url",
  40. "http://w...content-available-to-author-only...e.com/"));
  41.  
  42. httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
  43.  
  44. httpPost.setHeader("Content-Type",
  45. "application/x-www-form-urlencoded; charset=UTF-8");
  46. httpPost.setHeader("Host", "dcid.dcinside.com");
  47. httpPost.setHeader("Referer", "http://w...content-available-to-author-only...e.com/");
  48. httpPost.setHeader("Origin", "http://w...content-available-to-author-only...e.com");
  49. httpPost.setHeader(
  50. "User-Agent",
  51. "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19");
  52.  
  53. HttpResponse response = httpclient.execute(httpPost);
  54. HttpEntity entity = response.getEntity();
  55.  
  56. response.getEntity().getContent(), "UTF-8"));
  57.  
  58. String t;
  59. while ((t = bf.readLine()) != null) {
  60. Controller.result.add(t);
  61. }
  62. if (Controller.result.contains(" history.back(-1);")) {
  63. //System.out.println("** 濡쒓렇???ㅽ뙣");
  64. String reason = Controller.result.get(25);
  65. String reason2[] = reason.split("'");
  66. //System.out.println("** ?댁쑀 : " + reason2[1]);
  67. Controller.state = reason2[1];
  68.  
  69. } else {
  70. //System.out.println("** 濡쒓렇?몄뿉 ?깃났?덉뒿?덈떎.");
  71. Controller.state = "login_ok";
  72. }
  73. System.out.println("** ?쒕쾭?먯꽌 ?묐떟??嫄곕??덉뒿?덈떎.");
  74. System.out.println("** 李⑤떒??媛ㅻ줈洹몄씪 ???덉뒿?덈떎.");
  75. // JMBCore.resultLog("ArrayIndexOutOfBoundsException",
  76. // "memberCheck");
  77.  
  78. }
  79. } // memberCheck end
  80.  
  81. public static void gnoGet(String name) throws Exception {
  82. try {
  83. Document doc = (Document) Jsoup
  84. .connect(
  85. "http://m...content-available-to-author-only...e.com/gallog/home.php?g_id="
  86. + name)
  87. .userAgent(
  88. "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
  89. .get();
  90. Elements gnoGet = doc.select(".list_picture li");
  91. String[] gnoProcess1 = gnoGet.html().split("g_no=");
  92. String[] gnoProcess2 = gnoProcess1[1].split("\">");
  93. int gno = Integer.parseInt(gnoProcess2[0]);
  94. Controller.gno = gno + 1;
  95. } catch (Exception e) {
  96. gnoGet(name);
  97.  
  98. }
  99. }
  100.  
  101.  
  102. public static int end;
  103.  
  104.  
  105.  
  106.  
  107. public static void getGallogCode() throws Exception {
  108. try {
  109. Document doc = Jsoup.connect(
  110. "http://g...content-available-to-author-only...e.com/" + Controller.id).get();
  111. String htmlsource = doc.toString();
  112. String[] htmlSource2 = htmlsource.split("profile_no=");
  113. String[] htmlSource3 = htmlSource2[1].split("'");
  114. Controller.gallogCode = htmlSource3[0];
  115.  
  116. } catch (Exception e) {
  117. getGallogCode();
  118. }
  119. }
  120.  
  121. public static void getMemberName() throws Exception {
  122. try {
  123. Document doc = Jsoup
  124. .connect(
  125. "http://m...content-available-to-author-only...e.com/gallog/home.php?g_id="
  126. + Controller.id)
  127. .userAgent(
  128. "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
  129. .get();
  130. Elements count = doc.select(".title_gallog_info");
  131. String[] gallogName = count.text().split("]");
  132. Controller.name = gallogName[0].substring(1);
  133. } catch (Exception e) {
  134. getMemberName();
  135. }
  136. }
  137.  
  138. public static void getMemberCount() throws Exception {
  139. try {
  140. Document doc = Jsoup
  141. .connect(
  142. "http://m...content-available-to-author-only...e.com/gallog/home.php?g_id="
  143. + Controller.id)
  144. .userAgent(
  145. "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
  146. .get();
  147. Elements count = doc.select(".gall_write");
  148. Elements countReply = doc.select(".gall_reply");
  149. String[] getArticle = count.text().split("湲€ ");
  150. String[] getReply = countReply.text().split("湲€ ");
  151.  
  152. for (int i = 0; i < getArticle[1].length(); i++) {
  153. if (Character.isDigit(getArticle[1].charAt(i))) {
  154. sb.append(getArticle[1].charAt(i));
  155. }
  156. }
  157. String aResult = sb.toString();
  158.  
  159. for (int i = 0; i < getReply[1].length(); i++) {
  160. if (Character.isDigit(getReply[1].charAt(i))) {
  161. sb2.append(getReply[1].charAt(i));
  162. }
  163. }
  164. String rResult = sb2.toString();
  165.  
  166. Controller.articleCount = Integer.parseInt(aResult);
  167. Controller.replyCount = Integer.parseInt(rResult);
  168.  
  169. Controller.max = Controller.articleCount + Controller.replyCount;
  170.  
  171. if (Controller.max == 0) {
  172. System.out.println("** 吏€?멸쾶 ?놁쓬.");
  173.  
  174. getMemberName();
  175. }
  176.  
  177. System.out.println("** ?쒕쾭?먯꽌 ?묐떟??嫄곕??덉뒿?덈떎.");
  178. System.out.println("** 李⑤떒??媛ㅻ줈洹몄씪 ???덉뒿?덈떎.");
  179. } catch (Exception e) {
  180. getMemberCount();
  181. }
  182. }
  183.  
  184.  
  185.  
  186.  
  187. }
  188.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:28: error: class MemberModel is public, should be declared in a file named MemberModel.java
public class MemberModel {
       ^
Main.java:12: error: package org.apache.http does not exist
import org.apache.http.HttpEntity;
                      ^
Main.java:13: error: package org.apache.http does not exist
import org.apache.http.HttpResponse;
                      ^
Main.java:14: error: package org.apache.http does not exist
import org.apache.http.NameValuePair;
                      ^
Main.java:15: error: package org.apache.http.client does not exist
import org.apache.http.client.HttpClient;
                             ^
Main.java:16: error: package org.apache.http.client.entity does not exist
import org.apache.http.client.entity.UrlEncodedFormEntity;
                                    ^
Main.java:17: error: package org.apache.http.client.methods does not exist
import org.apache.http.client.methods.HttpPost;
                                     ^
Main.java:18: error: package org.apache.http.impl.client does not exist
import org.apache.http.impl.client.DefaultHttpClient;
                                  ^
Main.java:19: error: package org.apache.http.message does not exist
import org.apache.http.message.BasicNameValuePair;
                              ^
Main.java:20: error: package org.jsoup does not exist
import org.jsoup.Jsoup;
                ^
Main.java:21: error: package org.jsoup.nodes does not exist
import org.jsoup.nodes.Document;
                      ^
Main.java:22: error: package org.jsoup.select does not exist
import org.jsoup.select.Elements;
                       ^
Main.java:33: error: cannot find symbol
            HttpClient httpclient = new DefaultHttpClient();
            ^
  symbol:   class HttpClient
  location: class MemberModel
Main.java:33: error: cannot find symbol
            HttpClient httpclient = new DefaultHttpClient();
                                        ^
  symbol:   class DefaultHttpClient
  location: class MemberModel
Main.java:34: error: cannot find symbol
            HttpPost httpPost = new HttpPost(
            ^
  symbol:   class HttpPost
  location: class MemberModel
Main.java:34: error: cannot find symbol
            HttpPost httpPost = new HttpPost(
                                    ^
  symbol:   class HttpPost
  location: class MemberModel
Main.java:36: error: cannot find symbol
            java.util.List<NameValuePair> params = new ArrayList<NameValuePair>();
                           ^
  symbol:   class NameValuePair
  location: class MemberModel
Main.java:36: error: cannot find symbol
            java.util.List<NameValuePair> params = new ArrayList<NameValuePair>();
                                                                 ^
  symbol:   class NameValuePair
  location: class MemberModel
Main.java:37: error: cannot find symbol
            params.add(new BasicNameValuePair("user_id", name));
                           ^
  symbol:   class BasicNameValuePair
  location: class MemberModel
Main.java:38: error: cannot find symbol
            params.add(new BasicNameValuePair("password", password));
                           ^
  symbol:   class BasicNameValuePair
  location: class MemberModel
Main.java:39: error: cannot find symbol
            params.add(new BasicNameValuePair("s_url",
                           ^
  symbol:   class BasicNameValuePair
  location: class MemberModel
Main.java:42: error: cannot find symbol
            httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
                                   ^
  symbol:   class UrlEncodedFormEntity
  location: class MemberModel
Main.java:53: error: cannot find symbol
            HttpResponse response = httpclient.execute(httpPost);
            ^
  symbol:   class HttpResponse
  location: class MemberModel
Main.java:54: error: cannot find symbol
            HttpEntity entity = response.getEntity();
            ^
  symbol:   class HttpEntity
  location: class MemberModel
Main.java:61: error: package Controller does not exist
                Controller.result.add(t);
                          ^
Main.java:63: error: package Controller does not exist
            if (Controller.result.contains("				history.back(-1);")) {
                          ^
Main.java:65: error: package Controller does not exist
                String reason = Controller.result.get(25);
                                          ^
Main.java:68: error: cannot find symbol
                Controller.state = reason2[1];
                ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:72: error: cannot find symbol
                Controller.state = "login_ok";
                ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:85: error: cannot find symbol
            Document doc = (Document) Jsoup
            ^
  symbol:   class Document
  location: class MemberModel
Main.java:85: error: cannot find symbol
            Document doc = (Document) Jsoup
                            ^
  symbol:   class Document
  location: class MemberModel
Main.java:85: error: cannot find symbol
            Document doc = (Document) Jsoup
                                      ^
  symbol:   variable Jsoup
  location: class MemberModel
Main.java:92: error: cannot find symbol
            Elements gnoGet = doc.select(".list_picture li");
            ^
  symbol:   class Elements
  location: class MemberModel
Main.java:96: error: cannot find symbol
            Controller.gno = gno + 1;
            ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:111: error: cannot find symbol
            Document doc = Jsoup.connect(
            ^
  symbol:   class Document
  location: class MemberModel
Main.java:112: error: cannot find symbol
                    "http://gallog.dcinside.com/" + Controller.id).get();
                                                    ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:111: error: cannot find symbol
            Document doc = Jsoup.connect(
                           ^
  symbol:   variable Jsoup
  location: class MemberModel
Main.java:116: error: cannot find symbol
            Controller.gallogCode = htmlSource3[0];
            ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:125: error: cannot find symbol
            Document doc = Jsoup
            ^
  symbol:   class Document
  location: class MemberModel
Main.java:128: error: cannot find symbol
                            + Controller.id)
                              ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:125: error: cannot find symbol
            Document doc = Jsoup
                           ^
  symbol:   variable Jsoup
  location: class MemberModel
Main.java:132: error: cannot find symbol
            Elements count = doc.select(".title_gallog_info");
            ^
  symbol:   class Elements
  location: class MemberModel
Main.java:134: error: cannot find symbol
            Controller.name = gallogName[0].substring(1);
            ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:142: error: cannot find symbol
            Document doc = Jsoup
            ^
  symbol:   class Document
  location: class MemberModel
Main.java:145: error: cannot find symbol
                            + Controller.id)
                              ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:142: error: cannot find symbol
            Document doc = Jsoup
                           ^
  symbol:   variable Jsoup
  location: class MemberModel
Main.java:149: error: cannot find symbol
            Elements count = doc.select(".gall_write");
            ^
  symbol:   class Elements
  location: class MemberModel
Main.java:150: error: cannot find symbol
            Elements countReply = doc.select(".gall_reply");
            ^
  symbol:   class Elements
  location: class MemberModel
Main.java:170: error: cannot find symbol
            Controller.articleCount = Integer.parseInt(aResult);
            ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:171: error: cannot find symbol
            Controller.replyCount = Integer.parseInt(rResult);
            ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:173: error: cannot find symbol
            Controller.max = Controller.articleCount + Controller.replyCount;
            ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:173: error: cannot find symbol
            Controller.max = Controller.articleCount + Controller.replyCount;
                             ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:173: error: cannot find symbol
            Controller.max = Controller.articleCount + Controller.replyCount;
                                                       ^
  symbol:   variable Controller
  location: class MemberModel
Main.java:175: error: cannot find symbol
            if (Controller.max == 0) {
                ^
  symbol:   variable Controller
  location: class MemberModel
54 errors
stdout
Standard output is empty