本文整理汇总了PHP中getremotefile函数的典型用法代码示例。如果您正苦于以下问题:PHP getremotefile函数的具体用法?PHP getremotefile怎么用?PHP getremotefile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getremotefile函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dheader
}
if ($cmd) {
dheader("{$cmd}: {$url}");
exit;
}
}
if ($readmod == 4) {
dheader('Accept-Ranges: bytes');
if (!empty($_SERVER['HTTP_RANGE'])) {
$rangesize = $filesize - $range > 0 ? $filesize - $range : 0;
dheader('Content-Length: ' . $rangesize);
dheader('HTTP/1.1 206 Partial Content');
dheader('Content-Range: bytes=' . $range . '-' . ($filesize - 1) . '/' . $filesize);
}
}
$attach['remote'] ? getremotefile($attach['attachment']) : getlocalfile($filename, $readmod, $range);
function getremotefile($file)
{
global $_G;
@set_time_limit(0);
if (!@readfile($_G['setting']['ftp']['attachurl'] . 'forum/' . $file)) {
$ftp = ftpcmd('object');
$tmpfile = @tempnam($_G['setting']['attachdir'], '');
if ($ftp->ftp_get($tmpfile, 'forum/' . $file, FTP_BINARY)) {
@readfile($tmpfile);
@unlink($tmpfile);
} else {
@unlink($tmpfile);
return FALSE;
}
}
示例2: ftp_testOp
public function ftp_testOp()
{
/**
* 读取语言包
*/
$lang = Language::getLangContent();
$message = '';
$testcontent = md5('ShopNC' . MD5_KEY . time());
$testfile = 'test/shopnc_test.txt';
$attach_dir = BasePath . '/upload';
@mkdir($attach_dir . '/test', 0777);
if ($fp = @fopen($attach_dir . '/' . $testfile, 'w')) {
fwrite($fp, $testcontent);
fclose($fp);
}
import('function.ftp');
if (!$message) {
$GLOBALS['setting_config']['ftp_open'] = 1;
$GLOBALS['setting_config']['ftp_server'] = $_POST['ftp_server'];
$GLOBALS['setting_config']['ftp_ssl_state'] = $_POST['ftp_ssl_state'];
$GLOBALS['setting_config']['ftp_port'] = $_POST['ftp_port'];
$GLOBALS['setting_config']['ftp_username'] = $_POST['ftp_username'];
$GLOBALS['setting_config']['ftp_password'] = $_POST['ftp_password'];
$GLOBALS['setting_config']['ftp_pasv'] = $_POST['ftp_pasv'];
$GLOBALS['setting_config']['ftp_attach_dir'] = $_POST['ftp_attach_dir'];
$GLOBALS['setting_config']['ftp_access_url'] = $_POST['ftp_access_url'];
$GLOBALS['setting_config']['ftp_timeout'] = $_POST['ftp_timeout'];
ftpcmd('upload', 'upload/' . $testfile);
$ftp = ftpcmd('object');
if (ftpcmd('error')) {
$message = $lang['ftp_error_' . ftpcmd('error')];
}
if (!$message) {
$str = getremotefile(C('ftp_access_url') . '/upload/' . $testfile);
if ($str !== $testcontent) {
$message = $lang['ftp_error_geterr'];
}
}
if (!$message) {
ftpcmd('delete', $testfile);
ftpcmd('delete', 'test/index.html');
$ftp->ftp_rmdir('test');
$str = getremotefile(C('ftp_attach_dir') . '/' . $testfile);
if ($str === $testcontent) {
$message = $lang['ftp_error_delerr'];
}
@unlink($attach_dir . '/' . $testfile);
@rmdir($attach_dir . 'test');
}
}
if (!$message) {
$message = $lang['ftp_test_ok'];
}
if (strtoupper(CHARSET) == 'GBK') {
$message = Language::getUTF8($message);
}
showMessage($message, '', 'json');
}
示例3: ftpcmd
ftpcmd('upload', $testfile);
$ftp = ftpcmd('object');
if (ftpcmd('error')) {
$alertmsg = cplang('setting_attach_remote_' . ftpcmd('error'));
}
if (!$alertmsg) {
$str = getremotefile($_G['setting']['ftp']['attachurl'] . $testfile);
if ($str !== $testcontent) {
$alertmsg = cplang('setting_attach_remote_geterr');
}
}
if (!$alertmsg) {
ftpcmd('delete', $testfile);
ftpcmd('delete', 'test/index.htm');
$ftp->ftp_rmdir('test');
$str = getremotefile($_G['setting']['ftp']['attachurl'] . $testfile);
if ($str === $testcontent) {
$alertmsg = cplang('setting_attach_remote_delerr');
}
@unlink($attach_dir . '/' . $testfile);
@rmdir($attach_dir . 'test');
}
}
if (!$alertmsg) {
$alertmsg = cplang('setting_attach_remote_ok');
}
echo '<script language="javascript">alert(\'' . str_replace('\'', '\\\'', $alertmsg) . '\');parent.$(\'cpform\').action=\'' . ADMINSCRIPT . '?action=setting&edit=yes\';parent.$(\'cpform\').target=\'_self\'</script>';
} elseif ($operation == 'mailcheck') {
$oldmail = dunserialize($_G['setting']['mail']);
$settingnew = $_GET['settingnew'];
$oldsmtp = $settingnew['mail']['mailsend'] == 3 ? $settingnew['mail']['smtp'] : $settingnew['mail']['esmtp'];
示例4: dheader
$range = 0;
if ($readmod == 4) {
dheader('Accept-Ranges: bytes');
if (!empty($_SERVER['HTTP_RANGE'])) {
list($range) = explode('-', str_replace('bytes=', '', $_SERVER['HTTP_RANGE']));
$rangesize = $filesize - $range > 0 ? $filesize - $range : 0;
dheader('Content-Length: ' . $rangesize);
dheader('HTTP/1.1 206 Partial Content');
dheader('Content-Range: bytes=' . $range . '-' . ($filesize - 1) . '/' . $filesize);
}
}
if (!$attach['remote']) {
error_reporting(0);
getlocalfile($filename, $readmod, $range);
} else {
if (!getremotefile($attach['attachment'])) {
showmessage('attachment_nonexistence');
}
}
function getremotefile($file)
{
global $authkey, $ftp, $attachdir;
@set_time_limit(0);
if (!@readfile($ftp['attachurl'] . '/' . $file)) {
require_once DISCUZ_ROOT . './include/ftp.func.php';
if (!($ftp['connid'] = dftp_connect($ftp['host'], $ftp['username'], authcode($ftp['password'], 'DECODE', md5($authkey)), $ftp['attachdir'], $ftp['port'], $ftp['ssl']))) {
return FALSE;
}
$tmpfile = @tempnam($attachdir, '');
if (dftp_get($ftp['connid'], $tmpfile, $file, FTP_BINARY)) {
@readfile($tmpfile);