sethyz Posted October 30, 2008 Share Posted October 30, 2008 I'm having problems with this file not posting to the file on the website to update my webpage. let me know if you can help <?php // If no cookie is present, redirect the user. // if (!isset($_COOKIE['password'])) { require_once ('central.php'); // Connect to the stored password page. if ($stored_password != $_COOKIE['password']) { header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "login.php"); exit(); // Quit the script. } ?> <html> <head> <title>Sc0tsman.com information Updater</title> <LINK REL="stylesheet" HREF="stylesheet.css" TYPE="text/css"> </head> <body> <table align="center" border="0"><tr><td> <?php $newsboxid = "$_REQUEST[newsid]"; if (empty($submit_news_update)) $submit_news_update = ""; if (empty($newsboxid)) $newsboxid = ""; $boxon = "on"; $news = "newsfile" . "$newsboxid" ; //--------------------------------------------------------- if ($submit_news_update == "Submit Update"){ trim($news_box); $news_box_text = "newsphp/$news.txt"; $FilePointer = fopen ($news_box_text, "w"); fwrite ($FilePointer, $news_box); fclose ($FilePointer); $boxon = "no"; print "<br> <br><b>The information has been updated!<br> <br> <br> <br><a href=\"$homepage\">Back to the Home page</a>"; } ## If we are not submitting an update we just need to open the text file ansd read it but first ## we need to check if the file is there first if ($submit_news_update == "" && file_exists("newsphp/$news.txt")) { $boxon = "no"; $news_box_text = "newsphp/$news.txt"; $Open = fopen ($news_box_text, "r"); $existing_news_array = file ($news_box_text); $existing_news = implode("", $existing_news_array); fclose ($Open); trim($existing_news); $new_line = ""; //$existing_news = ereg_replace("[\n\r]", "$new_line", "$existing_news"); $existing_news = ereg_replace("[\n]", "$new_line", "$existing_news"); $existing_news = stripslashes($existing_news); print ' <br> <br><a href="listing_manager.php">Back to the manager select page</a><br> <br> <p><h2>Information box updater'; print " $newsboxid"; print ' </h2></p> <FORM ACTION="update_news.php" METHOD=POST> <textarea rows=15 cols=50 name="news_box" class="input_text_area">'; print "$existing_news"; print '</textarea><br> <input type="hidden" name="newsid" value="'; print $newsboxid ; print '"><input type="submit" name="submit_news_update" value="Submit Update"> '; } if ($boxon == "no") { ## Do nothing } else { print ' <br> <br><a href="listing_manager.php">Back to the manager select page</a><br> <br> <p><h2>Create content for information box'; print " $newsboxid"; print ' </h2></p> <FORM ACTION="update_news.php" METHOD=POST> <textarea rows=15 cols=50 name="news_box" class="input_text_area">'; print '</textarea><br> <input type="hidden" name="newsid" value="'; print $newsboxid ; print '"><input type="submit" name="submit_news_update" value="Submit Update"> '; } ?> </body> </html> (edited by kenrbnsn to add tags) Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted October 30, 2008 Share Posted October 30, 2008 try changing this... $newsboxid = "$_REQUEST[newsid]"; to this... $newsboxid = $_POST['newsid']; Quote Link to comment Share on other sites More sharing options...
sethyz Posted October 30, 2008 Author Share Posted October 30, 2008 I thought that was for the page request like update_news.php?newsid=2 etc. anyways I gave it a try and no go it stoped reading the files I already have added goto http://sc0tsman.x10hosting.com/login.php the password is password32 tell me what you think, cause I can't get it to work. Quote Link to comment Share on other sites More sharing options...
sethyz Posted October 31, 2008 Author Share Posted October 31, 2008 If this helps anyone the full script is at this site. http://www.crockerwebdesign.com/phpscripts.html I've emailed the coder but no reply, can anyone get it to work? Quote Link to comment 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.