Schlo_50 Posted November 1, 2007 Share Posted November 1, 2007 I had been using a script locally, which worked, but then uploaded it to a windows server and now suddenly it does nothing and i've set the permissions of the .txt file to 777..This sadly happened to me before and i cannot for the life of me remember how i fixed it. Possibly i used a linux server instead but i thought i'd let you lot see the code to try to spot any obvious glitches. <?php $loadcontent = "steadshome.txt"; if (isset($_POST['save_file'])) { $savecontent = (isset($_POST['savecontent']))?$_POST['savecontent']:""; $fp = @fopen($loadcontent, "w"); if ($fp) { fwrite($fp, $savecontent); fclose($fp); } } $fp = @fopen($loadcontent, "r"); $loadcontent = fread($fp, filesize($loadcontent)); $loadcontent = htmlspecialchars($loadcontent); fclose($fp); ?> <?php $a .= "<img border=\"0\" src=\"images/bold.jpg\" width=\"25\" height=\"25\" alt=\"Bold\" onClick=\"selectit('<b>Text Here</b>')\"> "; $b .= "<img border=\"0\" src=\"images/underline.jpg\" width=\"25\" height=\"25\" alt=\"Underline\" onClick=\"selectit('<u>Text Here</u>')\"> "; $c .= "<img border=\"0\" src=\"images/link.jpg\" width=\"25\" height=\"25\" alt=\"Hyperlink\" onClick=\"selectit('<a href=http://www.edit URL.com target=_blank>Edit Site Name</a>')\"> "; $d .= "<img border=\"0\" src=\"images/italic.jpg\" width=\"25\" height=\"25\" alt=\"Italics\" onClick=\"selectit('<i></i>')\"> "; ?> </p> <div align="center"> <span class="style"> <?php echo("$a"); echo("$b"); echo("$c"); echo("$d"); ?> </span></div> <form action="worked.php" target="_blank" method="post" name="savecontent" id="savecontent"> <div align="center"> <span class="style"> <textarea name="savecontent" cols="70" rows="25"><?=$loadcontent?> </textarea> <br /> <input type="submit" name="save_file" value="Save" /> </span></div> </form> <p align="center" class="style5"><span class="style11"><strong>Homepage preview</strong></span><strong>:</strong><br /> <br /> </label> <span class="style5"> <?php $file = file("steadshome.txt"); foreach($file as $key => $val){ $data[$key] = explode("|", $val); $news = $data[$key][0]; $outb = "$news<br>"; print( $outb ); } ?> </span> </p> <p align="center"> </p> <p align="center" class="style"> <input type="button" onClick="history.go(0)" VALUE="Refresh"> <br><br><br><span class="style5">_____________________________________</span></p> Thanks in advance for any help!! Quote Link to comment https://forums.phpfreaks.com/topic/75634-solved-script-not-working/ Share on other sites More sharing options...
kenrbnsn Posted November 1, 2007 Share Posted November 1, 2007 Remove the "@" from in front of the "fopen" functions and see what errors are shown. The "@" suppresses the error message. Ken Quote Link to comment https://forums.phpfreaks.com/topic/75634-solved-script-not-working/#findComment-382718 Share on other sites More sharing options...
Schlo_50 Posted November 2, 2007 Author Share Posted November 2, 2007 I have removed the '@' from all places but still, the script appears to work but my .txt file does not update with the new information typed into the text area. ??? Could it be possible that a linux server would run this script and not a windows server for some reason? Quote Link to comment https://forums.phpfreaks.com/topic/75634-solved-script-not-working/#findComment-383376 Share on other sites More sharing options...
poizn Posted November 2, 2007 Share Posted November 2, 2007 Silly question maybe, but have you checked if $_POST["save_file"] and $_POST["savecontent"] have the correct values in them? (sorry if i'm asking a really dumb question) Quote Link to comment https://forums.phpfreaks.com/topic/75634-solved-script-not-working/#findComment-383416 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.