function getPairs($days, $data) { $highest = []; $slice = array_slice($data, 0, $days); foreach ($slice as $day) { for ($first = 1; $first <= 60; $first++) { for ($second = 1; $second <= 60; $second++) { if ($first != $second) { $pair = [$first, $second]; if (isset($highest[join('+', array_reverse($pair))])) { continue; } if (subsearch($day, $pair)) { if (!isset($highest[join('+', $pair)])) { $highest[join('+', $pair)] = 1; } else { $highest[join('+', $pair)]++; } } } } } } arsort($highest); return $highest; }
function http($url, $postdata = "", $ref = "", $cookie = "") { $urlServer = subsearch($url, "//", "/"); $urlPath = str_replace("http://" . $urlServer, "", $url); $query = "POST " . $urlPath . " HTTP/1.1\r\n"; $query .= "Accept: */*\r\n"; $query .= "Referer: {$ref}\r\n"; $query .= "Accept-Language: ko\r\n"; $query .= "Content-Type: application/x-www-form-urlencoded; Charset=UTF-8\r\n"; $query .= "User-agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\r\n"; $query .= "Host: " . $urlServer . "\r\n"; $query .= "Content-Length: " . strlen($postdata) . "\r\n"; if ($cookie) { $query .= "Cookie: " . $cookie . "\r\n"; } $query .= "Connection: Keep-Alive\r\n"; $query .= "\r\n"; $query .= $postdata . "\r\n"; $fp = fsockopen($urlServer, "80", $errno, $errstr, 30); $buffer = ""; if (!$fp) { exit("{$errstr} ({$errno})"); } else { fputs($fp, $query); while (!feof($fp)) { $buffer .= fgets($fp, 1024); } fclose($fp); } return $buffer; }
function http($url, $postdata = "", $ref = "") { $urlServer = subsearch($url, "//", "/"); $urlPath = str_replace("http://" . $urlServer, "", $url); $query = "POST " . $urlPath . " HTTP/1.1\r\n"; $query .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n"; $query .= "Referer: {$ref}\r\n"; $query .= "Accept-Language: ko\r\n"; $query .= "Content-Type: application/x-www-form-urlencoded\r\n"; $query .= "Accept-Encoding: gzip, deflate\r\n"; $query .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; InfoPath.2; .NET CLR 3.5.30729)\r\n"; $query .= "Host: " . $urlServer . "\r\n"; $query .= "Content-Length: " . strlen($postdata) . "\r\n"; $query .= "\r\n"; $query .= $postdata . "\r\n"; $fp = fsockopen($urlServer, "80", $errno, $errstr, 30); $buffer = ""; if (!$fp) { exit("{$errstr} ({$errno})"); } else { fputs($fp, $query); for (;;) { if (!feof($fp)) { $buffer .= fgets($fp, 1024); } else { break; } } fclose($fp); } return $buffer; }
function http($url, $method, $cookie = "", $postdata = "", $ref = "") { $urlServer = subsearch($url, "//", "/"); $urlPath = str_replace("http://" . $urlServer, "", $url); if ($method == "get") { $query = "GET " . $urlPath . " HTTP/1.0\r\n"; $query .= "Accept: */*\r\n"; if ($ref) { $query .= "Referer: " . $ref . "\r\n"; } $query .= "Accept-Language: ko\r\n"; $query .= "User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Wndows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Wndows NT 5.1; SV1) ; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727)\r\n"; $query .= "Host: " . $urlServer . "\r\n"; $query .= "Connection: Keep-Alive\r\n"; if ($cookie) { $query .= "Cookie: " . $cookie . "\r\n"; } $query .= "\r\n"; $fp = fsockopen($urlServer, "80", $errno, $errstr, 30); } elseif ($method == "post") { $query = "POST " . $urlPath . " HTTP/1.0\r\n"; $query .= "Accept: */*\r\n"; if ($ref) { $query .= "Referer: " . $ref . "\r\n"; } $query .= "Accept-Language: ko\r\n"; $query .= "Content-Type: application/x-www-form-urlencoded\r\n"; $query .= "User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727)\r\n"; $query .= "Host: " . $urlServer . "\r\n"; $query .= "Content-Length: " . strlen($postdata) . "\r\n"; if ($cookie) { $query .= "Cookie: " . $cookie . "\r\n"; } $query .= "Connection: Keep-Alive\r\n"; $query .= "\r\n"; $query .= $postdata . "\r\n"; $fp = fsockopen($urlServer, "80", $errno, $errstr, 30); } else { $query = "GET " . $urlPath . " HTTP/1.0\r\n"; $query .= "Accept: */*\r\n"; if ($ref) { $query .= "Referer: " . $ref . "\r\n"; } $query .= "Accept-Language: ko\r\n"; $query .= "User-agent: Mozilla/4.0 (compatible; MSIE 7.0; Wndows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Wndows NT 5.1; SV1) ; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727)\r\n"; $query .= "Host: " . $urlServer . "\r\n"; $query .= "Connection: Close\r\n"; if ($cookie) { $query .= "Cookie: " . $cookie . "\r\n"; } $query .= "\r\n"; $fp = fsockopen($urlServer, "8080", $errno, $errstr, 30); } $buffer = ""; if (!$fp) { echo "{$errstr} ({$errno})<br>\n"; } else { fputs($fp, $query); while (!feof($fp)) { $buffer .= fgets($fp, 1024); } fclose($fp); } return $buffer; }
function subsearch($str, $start, $end) { $str = str_replace(chr(34), "", $str); $pos1 = strpos($str, $start); if ($pos1 > 0) { $pos2 = strpos($str, $end, $pos1 + strlen($start)); return substr($str, $pos1 + strlen($start), $pos2 - ($pos1 + strlen($start))); } else { return "0"; } } $urlhost = $_POST['urlhost']; $type = $_GET['type']; if ($type == "1") { $url = "https://user.daum.net/joinuser/join_step1.do?t__nil_loginbox=registration"; } else { if ($type == "2") { $url = $_GET['urlhost']; } } $curl_obj = new Curl_class(); $curl_opt[CURLOPT_SSL_VERIFYPEER] = 0; $curl_opt[CURLOPT_SSLVERSION] = 1; $curl_obj->url = $url; $curl_obj->addopt = $curl_opt; $curl_obj->post = 0; $curl_obj->headers = 1; $curl_obj->action(); $buffer = $curl_obj->receive; $ret = subsearch($buffer, "JSESSIONID=", ";"); echo $ret;
function http($url, $method, $cookie = "", $postdata = "", $ref = "") { $urlServer = subsearch($url, "//", "/"); $urlPath = str_replace("http://" . $urlServer, "", $url); $query = "GET " . $urlPath . " HTTP/1.1\r\n"; $query .= "Accept: text/html, application/xhtml+xml, */*\r\n"; $query .= "Accept-Language: ko-KR\r\n"; $query .= "User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\r\n"; $query .= "Accept-Encoding: gzip, deflate\r\n"; $query .= "Host: " . $urlServer . "\r\n"; $query .= "Connection: Keep-Alive\r\n"; $query .= "\r\n"; $fp = @fsockopen($urlServer, "80", $errno, $errstr, 30); $buffer = ""; if (!$fp) { exit("{$errstr} ({$errno})"); } else { fputs($fp, $query); for ($i = 0; $i < 15; $i++) { $buffer .= fgets($fp, 1024); } fclose($fp); } return $buffer; }