Completed

Fix a simple PHP script

This project was successfully completed by aryan151 for $10 AUD in a day.

Get free quotes for a project like this
Employer working
Project Budget
$10 - $30 AUD
Completed In
1 day
Total Bids
19
Project Description

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>";

}

?>

Completed by:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

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