hey guys. I am trying to get this quotation to work, i
changed file / folder permitions to '646' CODE but when i open
add_quote.php and submit a message here :
http://therainbowpride.com/myphptests/add_quote.php
i get this error :
Warning: fopen(../quotes.txt): failed to open stream:
Permission denied in
/home/therainb/public_html/myphptests/add_quote.php on line 20
Your quotation could not be stored due to a system error.
this is my php code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Add A Quotation</title>
</head>
<body>
<?php // Script 11.1 - add-quote.php
// This script displays and handles an HTML form.
// This script takes text input and stores it in a text file.
// Address error handling.
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
if (isset ($_POST['submit'])) { // Handle form.
if ( !empty ($_POST['quote']) ) { // Check for the requiered
value.
if ($fp = fopen ('../quotes.txt', 'ab')) { // Try to open
file.
// Adjust for magic quotes.
if (ini_get ('magic_quotes_gpc')) {
$data = stripslashes ($_POST['quote']);
} else {
$data = $_POST['quote'];
}
fwrite ($fp, "$data\n"); // Write the data. Use \r\n on
Windows.
fclose ($fp); // Close the file.
// Print a message.
print "<p>Your quotation has been stored.</p>";
} else { // Could not open the file.
print "<p>Your quotation could not be stored due to a
system error.</p>";
}
} else { // Failed to enter a quotation.
print "<p>Please enter a quotation!</p>";
}
} // End of SUBMIT IF.
// Leave PHP and display the form.
?>
<form action="add_quote.php" method="post">
<p>
<textarea name="quote" rows="5" columns="30">Enter your
quotation here.</textarea>
<br />
<input type="submit" name="submit" value="Add This Quote!"
/>
</p>
</form>
</body>
</html>
Can someone help me out? I can seem to find where the error
is at .
Thank you so much