public function start() { $t1 = microtime(true); $db = db_connect(DBHOST, DBUSER, DBPASS, DBNAME); $sdb = db_connect('localhost:9306', '', '', 'rtindex'); $total_urls = count($this->urls); for ($i = 0; $i < $total_urls; $i++) { unset($res); file_put_contents('status.txt', 'Limetorrents::...' . $this->urls[$i]); $res = gethtml($this->urls[$i]); if (strstr($this->urls[$i], 'Movies')) { $category = 'movies'; } elseif (strstr($this->urls[$i], 'TV')) { $category = 'tv'; } elseif (strstr($this->urls[$i], 'Music')) { $category = 'music'; } elseif (strstr($this->urls[$i], 'Games')) { $category = 'games'; } elseif (strstr($this->urls[$i], 'Applications')) { $category = 'software'; } elseif (strstr($this->urls[$i], 'Anime')) { $category = 'anime'; } else { $category = 'other'; } $type = Rivr::getType($category); $this->index($res, $type, $db, $sdb); } $time = microtime(true) - $t1; $db->query("INSERT INTO crawls SET source_id = '{$this->source_id}', added_torrents = '{$this->added}', updated_torrents = '{$this->updated}', time = '{$time}';"); return array($this->added, $this->updated); }
public function start() { $t1 = microtime(true); $db = db_connect(DBHOST, DBUSER, DBPASS, DBNAME); $sdb = db_connect('localhost:9306', '', '', 'rtindex'); $total_urls = count($this->urls); for ($i = 0; $i < $total_urls; $i++) { unset($res); file_put_contents('status.txt', 'Kickass::...' . $this->urls[$i]); $res = gethtml($this->urls[$i]); $this->index($res, $db, $sdb); } $time = microtime(true) - $t1; $db->query("INSERT INTO crawls SET source_id = '{$this->source_id}', added_torrents = '{$this->added}', updated_torrents = '{$this->updated}', time = '{$time}';"); return array($this->added, $this->updated); }
function bottom() { eval(gethtml('bottom')); kprintend(); }
function weather() { //~ http://api.worldweatheronline.com/free/v1/weather.ashx?key=xxxxxxxxxxxxxxxxx&q=SW1&num_of_days=3&format=json //This cURL example requires php_curl. To verify installion, phpinfo(); //Failure to support cURL results in: PHP Fatal error: Call to undefined function curl_init() //Minimum request //Can be city,state,country, zip/postal code, IP address, longtitude/latitude. If long/lat are 2 elements, they will be assembled. IP address is one element. $loc_array = array("New York", "ny"); //data validated in foreach. $api_key = "xkq544hkar4m69qujdgujn7w"; //should be embedded in your code, so no data validation necessary, otherwise if(strlen($api_key)!=24) $num_of_days = 2; //data validated in sprintf $loc_safe = array(); foreach ($loc_array as $loc) { $loc_safe[] = urlencode($loc); } $loc_string = implode(",", $loc_safe); //To add more conditions to the query, just lengthen the url string $basicurl = sprintf('http://api.worldweatheronline.com/free/v1/weather.ashx?key=%s&q=%s&num_of_days=%s&format=json', $api_key, $loc_string, intval($num_of_days)); print $basicurl . "<br />\n"; //Premium API $premiumurl = sprintf('http://api.worldweatheronline.com/premium/v1/premium-weather-V2.ashx?key=%s&q=%s&num_of_days=%s&format=json', $api_key, $loc_string, intval($num_of_days)); $json_reply = gethtml($basicurl); $json = json_decode($json_reply); printf("<p>Current wind speed is %s mph blowing to %s</p>", $json->{'data'}->{'current_condition'}['0']->{'windspeedMiles'}, $json->{'data'}->{'current_condition'}['0']->{'winddir16Point'}); //~ print "<script>var weather= JSON.parse("; //~ print $json_reply; //~ print ");</script>"; print "<pre>"; print_r($json); print "</pre>"; }
<?php require_once 'includes/config.php'; require_once 'includes/rivr.php'; require_once 'includes/functions.php'; $type = $_GET['type']; $q = urldecode($_GET['q']); if ($q && ($type == 0 || $type == 1)) { $imdb_id = Rivr::findImdbId($q); if ($imdb_id > 0) { $imdb_id = 'tt' . str_pad($imdb_id, 7, '0', STR_PAD_LEFT); $mdata = json_decode(gethtml("http://www.omdbapi.com/?i={$imdb_id}&plot=short&r=json"), true); $poster = "cache/imdb_posters/{$imdb_id}.jpg"; if (!file_exists($poster)) { $ch = curl_init($mdata['Poster']); $fp = fopen($poster, 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); } echo "<a class=\"image\" href=\"{$poster}\"><img src=\"{$poster}\" class=\"poster\"></a><span class=\"title\">{$mdata['Title']} ({$mdata['Year']}) · {$mdata['Type']}</span><br/><br/><a class=\"ptag\" href=\"http://www.imdb.com/title/{$imdb_id}/\" target=\"blank\">IMDB link</a><a class=\"ptag\" href=\"#\" id=\"trailer\">Watch trailer</a><br/><br/><b>IMDB rating:</b> {$mdata['imdbRating']} ({$mdata['imdbVotes']} votes)<br/>{$mdata['Rated']} · {$mdata['Runtime']} · {$mdata['Genre']} · {$mdata['Released']}<br/><br/><div id='plot'><b>Plot:</b> {$mdata['Plot']}</div><br/><b>Actors:</b> {$mdata['Actors']}"; ?> <script> $(document).ready(function(){ var yt_url='https://content.googleapis.com/youtube/v3/search?part=snippet&type=video&videoEmbeddable=true&lr=en&orderby=viewCount&maxResults=1&hl=en&key=AIzaSyB0Jm1M4z4ffP3yFdEPFk-sd9XU5JabZLM&q=<?php echo urlencode(urldecode($mdata['Title'])); ?> +official+trailer';
public static function findImdbId($q) { $title = clean_text(str_replace(' ', '_', $q)); $imdb = gethtml("http://sg.media-imdb.com/suggests/{$q[0]}/{$title}.json"); while (strstr($imdb, '<Error>') && strlen($title) > 3) { $title = substr($title, 0, -1); $imdb = gethtml("http://sg.media-imdb.com/suggests/{$q[0]}/{$title}.json"); } if (!strstr($imdb, '<code>AccessDenied</code>')) { $imdb = str_replace('imdb$' . $title, 'imdb', $imdb); $imdb = str_replace('imdb({', '{', $imdb); $imdb = substr($imdb, 0, -1); $imdb = json_decode($imdb, true); $imdb = $imdb['d'][0]; if ($imdb['q'] == 'feature' || $imdb['q'] == 'TV series') { $imdb_id = str_replace('tt', '', $imdb['id']); } } if ($imdb_id == 0) { $imdb_id = -1; } return $imdb_id; }
?> </td></tr></table> </td> <td bgcolor=000000><img src=images/blank.gif width=1 height=1></td> </tr> <tr> <td bgcolor=000000><img src=images/blank.gif width=1 height=1></td> <td bgcolor=000000><img src=images/blank.gif width=278 height=1></td> <td bgcolor=000000><img src=images/blank.gif width=1 height=1></td> </tr> <tr> <td bgcolor=000000><img src=images/blank.gif width=1 height=1></td> <td> <FORM method=post action=admin_actions.php Target=_Blank name=admin_actions> <?php $html = gethtml(); print $html; ?> </FORM> </td> <td bgcolor=000000><img src=images/blank.gif width=1 height=1></td> </tr> <tr> <td bgcolor=000000><img src=images/blank.gif width=1 height=1></td> <td bgcolor=000000><img src=images/blank.gif width=278 height=1></td> <td bgcolor=000000><img src=images/blank.gif width=1 height=1></td> </tr> </table> <SCRIPT type="text/javascript"> function shouldireloadbot(){ window.parent.bottomof.shouldireload();
function doassert($name, $dispcode = true) { global $out, $req_dir, $req_pwd; global $_rSERVER; createsandbox($name); $real = get_real_contents($name); $expected = file_get_contents("{$req_dir}asserts/{$name}/expected.php?host={$_rSERVER['HTTP_HOST']}"); $succ = $real == $expected; $out = getjs($succ); $out .= gethtml($name, $succ, $real, $expected); }