$_SERVER['HTTP_REFERER'];
จะมีค่าก็ต่อเมื่อเราคลิกมาหน้าที่ ใช้ $_SERVER['HTTP_REFERER']; จากหน้าอื่นๆ เท่านั้นนะครับ
ถ้าเปิดโดยตรง จะไม่มีค่านี้ออกมาแสดง
เช่น
if(!file_exists($file))
{//page back
$Back = $_SERVER['HTTP_REFERER'];
header("location: $Back");
}else{
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
readfile($file);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น