Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI script for html content management

Status
Not open for further replies.

cdub05

Technical User
May 20, 2010
1
US
Hi all, first time poster. I have a problem that I am hoping can be solved here.

I work for a company that designs websites. I have finished one site, and after I finished it, my supervisor told me that the client we designed the site for, would like to have the ability to edit the site content. She said there was a CGI script that she used to use that allowed clients to edit text of thier pages without affecting the html code for the page, but she can't remember what it was or where she got it from(go figure). I need a CGI script that can do this. Can anybody help me out with this?
 
i have a file that contains my ping monitoring script
maybe you could point hosts.conf to index.html ?
that will allow you to edit the contents





<body bgcolor="darkred"><h3>Sample: <br> server to ping </h3>

<?php
$file = "hosts.conf"; // insert your filename or url here
if (!isset($_POST['submit']))
{
$fo = fopen($file, "r");
$fr = fread($fo, filesize($file));
if ( get_magic_quotes_gpc () ) $fr = stripslashes($fr);

$fr = str_replace("&", "&amp;", $fr);
$fr = str_replace("<", "&lt;", $fr);
$fr = str_replace(">", "&gt;", $fr);

echo "<form method='post' action='{$_SERVER['PHP_SELF']}'>
<textarea name='newfile' rows='60' cols='100'>{$fr}
</textarea>
<p>
<input type='submit' name='submit' value='Save' />
</form>";
fclose($fo);
}
else
{
$fo = fopen($file, "w");
$fw = fwrite($fo, (get_magic_quotes_gpc()?stripslashes($_POST['newfile']):$_POST['newfile']));
fclose($fo);
}
?><h1> Editing of the Rtr & SW Ping Monitor Status</h1><h2>when completed return to the status page</h2>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top