function getIds($parentid) { global $db; global $ids; $sql = "select rowid from producttype where parentid='" . $parentid . "'"; $rs = $db->Execute($sql); $rs_a = $rs->GetArray(); if (sizeof($rs_a) == 0) { return; } else { for ($i = 0; $i < sizeof($rs_a); $i++) { $ids = $ids . "," . $rs_a[$i]['rowid']; getIds($rs_a[$i]['rowid']); } } }
<?php $info = apc_cache_info("user"); foreach ($info as $key => $value) { var_dump($key) . PHP_EOL; } echo "<hr>"; var_dump(getIds()); apc_clear_cache(); apc_clear_cache('user'); function getIds() { $ci = apc_cache_info('user'); $keys = array(); foreach ($ci['cache_list'] as $entry) { $keys[] = $entry['info']; } return $keys; } if ($_GET["delete"]) { foreach (getIds() as $id) { apc_delete($id); } }
function updateLinks() { global $logger; $logger->info('UPDATE LINKS'); $resPirate = array(); //parallel RollingCurl RollingCurl::$rc = new RollingCurl("main_callback"); // the window size determines how many simultaneous requests to allow. RollingCurl::$rc->window_size = 5; //List of tracker loaders $loaders = array(); $rutorMain = RUTORROOT; $loaders[] = new RutorLoader("{$rutorMain}/browse/0/1/0/2/"); //foreign movies $loaders[] = new RutorLoader("{$rutorMain}/browse/1/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/2/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/3/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/4/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/5/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/6/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/7/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/8/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/9/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/10/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/11/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/12/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/13/1/0/2/"); $loaders[] = new RutorLoader("{$rutorMain}/browse/0/7/0/2/"); //multiplication $loaders[] = new RutorLoader("{$rutorMain}/browse/0/5/0/2"); //russian movies $loaders[] = new RutorLoader("{$rutorMain}/browse/1/5/0/2"); $NNMData = array("prev_sd" => 0, "prev_a" => 0, "prev_my" => 0, "prev_n" => 0, "prev_shc" => 0, "prev_shf" => 1, "prev_sha" => 1, "prev_shs" => 0, "prev_shr" => 0, "prev_sht" => 0, "f[0]" => 270, "o" => 10, "s" => 2, "tm" => -1, "ta" => -1, "sns" => -1, "sds" => -1, "nm" => "", "pn" => ""); $loaders[] = new NNMLoader("http://nnm-club.me/forum/tracker.php", $NNMData); $NNMData["f[0]"] = 218; $loaders[] = new NNMLoader("http://nnm-club.me/forum/tracker.php", $NNMData); $NNMData["f[0]"] = 217; $NNMData["f[1]"] = 954; $loaders[] = new NNMLoader("http://nnm-club.me/forum/tracker.php", $NNMData); $pirateMain = PIRATEROOT; $loaders[] = new PirateLoader("{$pirateMain}/browse/201/0/7/0"); /* $resPirate1 = new Pirate; $resPirate1->getPirateBay("https://pirateproxy.sx/browse/207/0/7"); $resPirate2 = new Pirate; $resPirate2->getPirateBay("https://pirateproxy.sx/browse/207/1/7"); $resPirate3 = new Pirate; $resPirate3->getPirateBay("https://pirateproxy.sx/browse/201/0/7"); $resPirate = array_merge($resPirate1->result, $resPirate2->result, $resPirate3->result, $resRutor, $resSeedoff); flush(); */ foreach ($loaders as $loader) { $loader->setLogger($logger); $loader->load(); } RollingCurl::$rc->execute(); //result array with torrent infos $result = array(); foreach ($loaders as $loader) { $result = array_merge($result, $loader->getResult()); } $resSeedoff = array(); $resSeedoff = seedoff\getSeedoff(); $resSeedoff = array_merge($resSeedoff, seedoff\getSeedoff("http://www.seedoff.net/index.php?page=ajax&active=0&options=0&recommend=0&sticky=0&period=0&category=14&options=0&order=5&by=2&pages=2")); $resSeedoff = array_merge($resSeedoff, seedoff\getSeedoff("http://www.seedoff.net/index.php?page=ajax&active=0&options=0&recommend=0&sticky=0&period=0&category=14&options=0&order=5&by=2&pages=3")); $resSeedoff = array_merge($resSeedoff, seedoff\getSeedoff("http://www.seedoff.net/index.php?page=ajax&active=0&options=0&recommend=0&sticky=0&period=0&category=64&options=0&order=5&by=2&pages=1")); $result = array_merge($result, $resSeedoff); foreach ($result as $cur) { if (trySkip($cur)) { continue; } getIds($cur['title_approx'], $cur); $logger->info("add link: " . $cur['title_approx'] . "::" . $cur['description'] . "::" . $cur['link']); $res = addLink($cur); if ($res !== 0) { $logger->warning("link was not added: {$res}"); } usleep(100 * 1000); } $logger->info(count($result) . " links updated"); }
$stmt->closeCursor(); return $origin['origin']; } $categories = array('cars' => 'legkovie', 'trucks' => 'kommercheskie', 'moto' => 'moto', 'water' => 'vodniy', 'air' => 'vozdushniy'); $categoryToBodytypes = array('cars' => array('внедорожник/кроссовер', 'лимузин', 'минивэн/фургон/пикап', 'седан', 'универсал', 'хетчбек', 'купе', 'кабриолет/родстер/гоночный'), 'trucks' => array('автобус', 'автодом', 'voennaya-tehnika', 'грузовик', 'коммунальная техника', 'легкий коммерческий', 'микроавтобус', 'прицеп', 'сельхоз-техника', 'строительная техника'), 'moto' => array('квадроцикл', 'мотоцикл', 'скутер/мопед/минибайк', 'снегоход/багги/карт'), 'water' => array('гидроцикл', 'катер/лодка', 'яхта/катамаран'), 'air' => array('самолет/вертолет')); $result = array(); $models = array(); foreach ($categories as $category => &$dirName) { $dirPath = PHP_FILES_PATH . $dirName; if (file_exists($dirPath)) { $files = scandir($dirPath); foreach ($files as &$file) { if ($file !== '.' && $file !== '..' && strpos($file, '_popular.php') === false) { $maker = str_replace('.php', '', $file); if (!isset($result[$maker]['categories'][$category])) { $bodyTypes = $categoryToBodytypes[$category]; $ids = getIds($maker, $bodyTypes); $models = getModels($ids); if (!empty($models)) { if (!isset($result[$maker]['origin'])) { $result[$maker]['origin'] = getOrigin($maker); } $result[$maker]['categories'][$category] = $models; } } } } } } $content = '<?php return ' . var_export($result, true) . ';'; $res = file_put_contents(PHP_FILES_PATH . 'home/maker_models.php', $content);
if ($run_cron != true) { exit; } $db->output_error = 1; //Set cron status $cron->set_cron_state('upd_info', 1); $cron->set_log(1); $cron->set_user_id(CRON_SEARCH_AUTH_ID); //Get credentials $ap_creds = $db->get_ap_creds(); $authUserData = $db->get_user_data(CRON_SEARCH_AUTH_ID); $connection = new TwitterOAuth($ap_creds['consumer_key'], $ap_creds['consumer_secret'], $authUserData['oauth_token'], $authUserData['oauth_token_secret']); $rate_con = $cron->get_remaining_hits(); $usersRequestsRemaining = intval($rate_con['ul_remaining']); while ($usersRequestsRemaining > 10) { $result = getIds($db); $user_ids = array(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $user_ids[] = $row['user_id']; } if (empty($user_ids)) { $cron->set_cron_state('upd_info', 0); exit; } if (!is_connected()) { //internet connection seems broken $cron->set_cron_state('upd_info', 0); exit; } $users_info = $connection->post('users/lookup', array('user_id' => implode(',', $user_ids))); $usersRequestsRemaining--;
$movie['kpid'] = $_POST['kpid']; } $res = addMovie($movie, true); echo $res === 0 ? "UPDATED\n" : "NOT UPDATED: {$res}\n"; print_r($movie); } else { echo "access denied"; } break; case "getIds": if (isAdmin($user['id'])) { $movie = array(); if ($_POST['year']) { $movie['year'] = (int) $_POST['year']; } getIds($_POST['title'], $movie); print_r($movie); if ($_POST['movieId']) { $movieId = (int) $_POST['movieId']; $kpid = mysqli_real_escape_string($GLOBALS['mysqli'], $movie['movie']['kpid']); $imdbid = mysqli_real_escape_string($GLOBALS['mysqli'], $movie['movie']['imdbid']); echo "Updating movie {$movieId}: kp {$kpid}, imdb {$imdbid}\n"; mysqli_query($GLOBALS['mysqli'], "UPDATE movies SET kpid='{$kpid}', imdbid='{$imdbid}' WHERE id = {$movieId}"); echo mysqli_error($GLOBALS['mysqli']); } } else { echo "access denied"; } break; case "getLogs": if (isAdmin($user['id'])) {
function addStatus($id_sensor, $status) { $sql = "INSERT INTO status (id_sensor, statusgas, created_at) VALUES (:id_sensor, :statusgas, :created_at)"; try { $db = getConnection(); $stmt = $db->prepare($sql); $stmt->bindParam("id_sensor", $id_sensor); $stmt->bindParam("statusgas", $status); $date = date("Y-m-d H:i:s"); $stmt->bindParam("created_at", $date); $stmt->execute(); //$id = $db->lastInsertId(); $db = null; } catch (PDOException $e) { return json_encode((object) ["error" => true, "message" => $e->getMessage()]); } $ids = getIds($id_sensor); if (count($ids) == 0) { return json_encode((object) ["error" => true, "message" => "Sensor tidak ditemukan"]); } echo send_notification($ids, "Status sensor sekarang " . $status); /* return json_encode((object) [ "error" =>false, "id_sensor"=>$id_sensor, "statusgas"=>$status, "message"=>"Status berhasil di update" ]); */ }