Zeradin Posted August 4, 2008 Share Posted August 4, 2008 Ok I have a very similar, just more complex system in a folder parallel to this one and I solved it by putting #php_flag magic_quotes_gpc off in .htaccess but for some reason I'm still getting the old problem in this form. upload page: <!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=utf-8" /> <title>News Upload Form</title> </head> <body> <!-- Upload Form --> <strong><u>News Item</u><br /><br /> <form method="POST" action="newstory.php"> <strong>News Title</strong><br /> <input type="text" name="title" size="20"><br /> <br /> <strong>Posted By</strong><br /> <input type="text" name="poster" size="20"><br /> <br /> <strong>Message</strong><br /> <textarea rows="30" name="message" cols="80"></textarea> <br /> <br /> <input type="submit" value="Submit" name="newssubmit"> </form><br /> <!-- End Upload Form --> <br /><hr><br /> </body> </html> the text file it writes into has the magic quotes and I can't figure out how to get rid of them. I've been trying any script i can find to remove them and it's not working. Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/ Share on other sites More sharing options...
Zeradin Posted August 4, 2008 Author Share Posted August 4, 2008 forgot to include probably the most important part... the processing page: <!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=utf-8" /> <title>Uploaded! Redirecting to Index...</title> <link href="css .css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function delayedRedirect(){ window.location = "home.php" } </script>--></head><BODY> <body onLoad="setTimeout('delayedRedirect()', 3000)" text="#000000"><br /> <?php // set file to write $file = "newslog.txt"; // open file $fh = fopen($file, 'a') or die('Could not open file!'); // write to file fwrite($fh, "$poster'[END]'$story'[END]'\n$date'[END]'\n$title'[END]'\n\n\n") or die('Could not write to file'); // close file fclose($fh); echo " You have uploaded news! You will be re-directed to the news page in one moment."; } else { echo "error"; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607833 Share on other sites More sharing options...
wildteen88 Posted August 4, 2008 Share Posted August 4, 2008 Ok I have a very similar, just more complex system in a folder parallel to this one and I solved it by putting #php_flag magic_quotes_gpc off in .htaccess but for some reason I'm still getting the old problem in this form. First of you'll need to remove the # at the start of line in order for Apache to read the line, otherwise it'll be ignored. Secondly the php_flag and php_value directives are only available if PHP is configured as an Apache Module only. Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607856 Share on other sites More sharing options...
Zeradin Posted August 4, 2008 Author Share Posted August 4, 2008 if that's the case why don't i have magic quotes on the other form anymore? when i remove the # i can't access any pages i just get an error Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607858 Share on other sites More sharing options...
wildteen88 Posted August 4, 2008 Share Posted August 4, 2008 If you're getting an error then either PHP isn't configured as an Apache module. Or the AllowOverride directive within the htttpd.conf does not permit it. Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607860 Share on other sites More sharing options...
Jabop Posted August 4, 2008 Share Posted August 4, 2008 Uhh what's the error? Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607862 Share on other sites More sharing options...
Zeradin Posted August 4, 2008 Author Share Posted August 4, 2008 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7a mod_bwlimited/1.4 Server at hypboard.com Port 80 i don't understand how i didn't add any script to the other form, but it works and this one doesn't Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607866 Share on other sites More sharing options...
wildteen88 Posted August 4, 2008 Share Posted August 4, 2008 What other form? I don't understand. Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607867 Share on other sites More sharing options...
Jabop Posted August 4, 2008 Share Posted August 4, 2008 That looks like a standard error when you have an htaccess without allowed overrides, or, you have an htaccess with calls to modules that aren't loaded. Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607870 Share on other sites More sharing options...
Zeradin Posted August 4, 2008 Author Share Posted August 4, 2008 like i have html_public/thehyp/uploadform.php and html_public/thehyp/newstory.php and html_public/TEST/upload.php and html_public/TEST/newstory.php I made the ones in TEST by basically cutting out tons of code and making the ones in TEST really really simplistic the .htaccess file is in html_public and if the # makes it not get read I don't understand why thehyp one doesn't have the magic quotes and the TEST one does Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607875 Share on other sites More sharing options...
Zeradin Posted August 4, 2008 Author Share Posted August 4, 2008 That looks like a standard error when you have an htaccess without allowed overrides, or, you have an htaccess with calls to modules that aren't loaded. i don't know what either of these things mean. how can i fix it? Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607876 Share on other sites More sharing options...
Jabop Posted August 4, 2008 Share Posted August 4, 2008 allow overrides in your directory via apache conf. make sure all modules being called are actually loaded in your apache conf or through htaccess (IF you have overrides enabled for that directory) Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607883 Share on other sites More sharing options...
Zeradin Posted August 4, 2008 Author Share Posted August 4, 2008 ok i'm talking to my webhost about this so they'll be able to help me with that, but I'm making the form for someone else, how do i use code to make sure this doesn't happen on their server? Quote Link to comment https://forums.phpfreaks.com/topic/118143-magic-quotes-what-the/#findComment-607924 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.