Jump to content

Recommended Posts

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!!

 

Link to comment
https://forums.phpfreaks.com/topic/75634-solved-script-not-working/
Share on other sites

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.