Hey there.
I've been implimenting FCKEditor into my clients websites so they can update the text and pictures on their own.
The way it is currently setup is that you need to 'login' to gain access to the editor. Once the changes are made, the user will click submit and the editor will write (in HTML) what the user wrote out in rich text.
The way that I have the editor writing to the file is like this:
I use the PHP fopen command to open the file, fwrite to write the contents to the file and save it, and then fclose to close the file.
My issue is that my host randomly decided to globally disable the fopen command. This means that none of my clients are able to update their website. Is there a work around to using the fopen command? Here is the script I use on every page. I have editted the password for security reasons.
[PHP]<?php
if($_REQUEST['thepassword'] == 'password')
{
if(($_REQUEST['content']!=''))
{
print basename($_SERV ER['PHP_SELF']) . '<br>';
$file = fopen(basename( $_SERVER['PHP_SELF']) . '.content', 'w');
fwrite($file,st ripslashes($_RE QUEST['content']));
fclose($file);
print '<b>Saved</b><br/><hr/><br/>';
$content = file_get_conten ts(basename($_S ERVER['SCRIPT_NAME']) . '.content');
print $content;
}else{
print '<form action="'.$_SER VER['PHP_SELF'].'" method="POST">' ;
$sBasePath = "fckeditor/";
$oFCKeditor = new FCKeditor('cont ent') ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Width = 660;
$oFCKeditor->Height = 600;
$oFCKeditor->Value = file_get_conten ts(basename($_S ERVER['SCRIPT_NAME']) . '.content');
$oFCKeditor->Enabled= true;
$oFCKeditor->Create();
print "<input type='hidden' name='thepasswo rd' value='" . $_REQUEST['thepassword'] . "'/>";
print '<br/><input type="submit" name="submit" value="Save"/>';
print '</form>';
}
}elseif($_REQUE ST['mode']=='login'){
print '<b>Please enter password:</b>';
print '<form action="'.$_SER VER['PHP_SELF'].'" method="POST">' ;
print '<input type="password" name="thepasswo rd" value=""/>';
print '<br/><input type="submit" name="submit" value="Login"/>';
}else{
$content = file_get_conten ts(basename($_S ERVER['SCRIPT_NAME']) . '.content');
print $content;
}
print '<br clear="all"/><br/><a href="' . $_SERVER['PHP_SELF'] . '?mode=login">' ;
print '<font color="#dddddd" size="-2">login</font></a>';
?>[/PHP]
If anyone can give me a quick alternative, it would be greatly appreciated, as right now it looks like I may need to redo all of my clients websites, and I simply don't have the time or man power to do that in a timely manner.
Thanks!
I've been implimenting FCKEditor into my clients websites so they can update the text and pictures on their own.
The way it is currently setup is that you need to 'login' to gain access to the editor. Once the changes are made, the user will click submit and the editor will write (in HTML) what the user wrote out in rich text.
The way that I have the editor writing to the file is like this:
I use the PHP fopen command to open the file, fwrite to write the contents to the file and save it, and then fclose to close the file.
My issue is that my host randomly decided to globally disable the fopen command. This means that none of my clients are able to update their website. Is there a work around to using the fopen command? Here is the script I use on every page. I have editted the password for security reasons.
[PHP]<?php
if($_REQUEST['thepassword'] == 'password')
{
if(($_REQUEST['content']!=''))
{
print basename($_SERV ER['PHP_SELF']) . '<br>';
$file = fopen(basename( $_SERVER['PHP_SELF']) . '.content', 'w');
fwrite($file,st ripslashes($_RE QUEST['content']));
fclose($file);
print '<b>Saved</b><br/><hr/><br/>';
$content = file_get_conten ts(basename($_S ERVER['SCRIPT_NAME']) . '.content');
print $content;
}else{
print '<form action="'.$_SER VER['PHP_SELF'].'" method="POST">' ;
$sBasePath = "fckeditor/";
$oFCKeditor = new FCKeditor('cont ent') ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Width = 660;
$oFCKeditor->Height = 600;
$oFCKeditor->Value = file_get_conten ts(basename($_S ERVER['SCRIPT_NAME']) . '.content');
$oFCKeditor->Enabled= true;
$oFCKeditor->Create();
print "<input type='hidden' name='thepasswo rd' value='" . $_REQUEST['thepassword'] . "'/>";
print '<br/><input type="submit" name="submit" value="Save"/>';
print '</form>';
}
}elseif($_REQUE ST['mode']=='login'){
print '<b>Please enter password:</b>';
print '<form action="'.$_SER VER['PHP_SELF'].'" method="POST">' ;
print '<input type="password" name="thepasswo rd" value=""/>';
print '<br/><input type="submit" name="submit" value="Login"/>';
}else{
$content = file_get_conten ts(basename($_S ERVER['SCRIPT_NAME']) . '.content');
print $content;
}
print '<br clear="all"/><br/><a href="' . $_SERVER['PHP_SELF'] . '?mode=login">' ;
print '<font color="#dddddd" size="-2">login</font></a>';
?>[/PHP]
If anyone can give me a quick alternative, it would be greatly appreciated, as right now it looks like I may need to redo all of my clients websites, and I simply don't have the time or man power to do that in a timely manner.
Thanks!
Comment