使用 header(); 时出现重定向循环错误;在 mysql_num_rows() 之后;如果我替换 header(); with echo 没有重定向循环错误。
<?php
require("includes/inc.php");
$id = trim(sanitize($_GET['id'])); //Receives the id of the file from the url
$fileid = mysql_query("SELECT * FROM files WHERE fileid = '$id'");
if (mysql_num_rows($fileid) != 1) {
header('Location: download.php?error=invalid_file');
} else {
echo "File Exist";
}
?>