Fix a simple PHP script

  • ステータス 完了済み
  • 予算 $10 - $30 AUD
  • Total Bids 19

プロジェクト情報

I wrote a script to open, edit and save a css file.

It only works if I put the css file in the same directory as the php script.

I need it to work when the css file is in a different directory to the css script.

For example:

The script is located in: /public_html/admin/[url removed, login to view]

The file I want to edit is located in: /public_html/includes/templates/responsive_classic/css/[url removed, login to view]

Please look at the script and see what is wrong.

The code I am using is:

<?php

if($_POST['Submit']){

$open = fopen('../includes/templates/responsive_classic/css/[url removed, login to view]',"w+");

$text = $_POST['update'];

fwrite($open, $text);

fclose($open);

echo "File updated.<br />";

echo "File:<br />";

$file = file('../includes/templates/responsive_classic/css/[url removed, login to view]');

foreach($file as $text) {

echo $text."<br />";

}

}else{

$file = file('../includes/templates/responsive_classic/css/[url removed, login to view]');

echo "<form action=\"".$PHP_SELF."\" method=\"post\">";

echo "<textarea Name=\"update\" cols=\"35\" rows=\"35\">";

foreach($file as $text) {

echo $text;

}

echo "</textarea>";

echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n

</form>";

}

?>

このようなプロジェクトの無料見積もりを取得
以下の方によって完了済み:

Looking to make some money?

  • 予算と期限を設定してください
  • Outline your proposal
  • Get paid for your work

このプロジェクトにも入札したフリーランサーを採用する

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online