2011年5月28日

FreeBSD雜記

轉自 http://www.openfoundry.org/index.php?option=com_content&task=view&id=8344&Itemid=4;isletter=1

/etc/resolve.conf DNS資訊
/etc/rc.conf ip設定

# tail /var/log/sudo.log 查看sudo log

#lastcomm 查看每位使用者執行的指令內容
需先在/etc/rc.conf 加入 accounting_enable="YES"
並 #/etc/rc.c/accounting start

#w 查看有誰登入主機

#watch TTY名稱 顯示該TTY的使用者的畫面

/etc/csh.cshrc tcsh shell環境設定檔

/etc/make.conf 設定port tree鏡像站

/etc/freebsd-update.conf 安全性更新設定檔

#freebsd-update fetch 下載安全更新
#freebsd-install 安裝更新

#sockstat 查看port狀態

2011年5月22日

php 下載檔案

直接從php madual抄來的例子

透過設定header的方式 當user連到這個頁面的時候就會直接下載檔案

< ?
$file= 'monkey.gif';

if (
file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>