function input($url, $sub = false) { if ($sub == true) { return sub_input($url); } $html = cacheurl($url); preg_match_all('|list-item leading(?:.*?)<a href="/(.*?)/videos/(.*?)/(\\d+)/" (?:.*?)>(.*?)</a>|is', $html, $matches); foreach ($matches[3] as $key => $row) { $tmp_array['url'] = "http://www.kabeleins.de/" . $matches[1][$key] . "/videos/" . $matches[2][$key] . "/" . $matches[3][$key] . "/"; $tmp_array['title'] = rep($matches[4][$key]); $tmp_array['type'] = "file"; $out[$tmp_array['title']] = $tmp_array; } #<h1><a href="/doku_reportage/wir_sind_viele/videos/artikel/14267/">Ab in den Schnee!</a></h1> preg_match_all('|<h1><a href="/(.*?)/vide(\\w)/(.*?)/(\\d+)/(?:.*?)>(.*?)</a></h1>|is', $html, $matches); foreach ($matches[3] as $key => $row) { $tmp_array['url'] = "http://www.kabeleins.de/" . $matches[1][$key] . "/vide" . $matches[2][$key] . "/" . $matches[3][$key] . "/" . $matches[4][$key] . "/"; $tmp_array['title'] = " " . rep($matches[5][$key]); $tmp_array['type'] = "file"; $out[$tmp_array['title']] = $tmp_array; } preg_match_all('|<p><a href="/(.*?)/vide(\\w)/(.*?)/(\\d+)/(?:.*?)linkstyle(?:.*?)>(.*?)</a></p>|', $html, $matches); foreach ($matches[3] as $key => $row) { $tmp_array['url'] = "http://www.kabeleins.de/" . $matches[1][$key] . "/vide" . $matches[2][$key] . "/" . $matches[3][$key] . "/" . $matches[4][$key] . "/"; $tmp_array['title'] = " " . rep($matches[5][$key]); $tmp_array['type'] = "file"; $out[$tmp_array['title']] = $tmp_array; } return $out; }
$http['size_lefts'] = array(); $http['dataToconnects'] = array(); $http['posInPoint'] = array(); $http['DownloadSpeed'] = array(); $files = "C:\\Users\\Я\\Desktop\\server_eLaiL\\htdocs\\"; $con_i = 0; $pointer = 0; while (true) { $present = null; $connect = @socket_accept($sock); //Проверяем новое подключение if ($connect !== false) { $input_data = @socket_read($connect, 1024); if ($input_data !== false) { $filename = @sub_input($input_data, "GET /", " "); $ip_xosta = @sub_input($input_data, "Referer: ", "\n"); $data_paketa = $ip_xosta . "," . $filename; $dirrr = $files . $filename; $exist = file_exists($dirrr); if ($exist !== false) { $kays_datu = array_keys($http['dataToconnects']); foreach ($kays_datu as $k => $value) { $mass_paketov = $http['dataToconnects'][$value]; if ($data_paketa === $mass_paketov) { $http['connects'][$value][] = $connect; $present = true; } } if ($present === false or $present === null) { //Если такого нету $http['connects'][$con_i][] = $connect;