解决fopen()命令 [英] Working around the fopen() command

查看:73
本文介绍了解决fopen()命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿那里。


我一直在将FCKEditor推荐到我的客户网站,以便他们可以自己更新文字和图片。


目前设置的方式是您需要登录以获得对编辑器的访问权限。一旦做出更改,用户将单击提交,编辑器将以(以HTML格式)编写用户以富文本形式写出的内容。


编辑器编写的方式文件是这样的:


我使用PHP fopen命令打开文件,fwrite将内容写入文件并保存,然后fclose关闭文件。 br />

我的问题是我的主机随机决定全局禁用fopen命令。这意味着我的客户都无法更新其网站。是否有使用fopen命令的工作?这是我在每个页面上使用的脚本。出于安全原因,我编辑了密码。


[PHP]<?php

if($ _ REQUEST [''thepassword''] ==''password'')

{

if(($ _ REQUEST [''content'']!=''''))

{

print basename($ _ SERVER [''PHP_SELF''])。 ''< br>'';

$ file = fopen(basename($ _ SERVER [''PHP_SELF''])。''。。'''',''w''); < br $>
fwrite($ file,stripslashes($ _ REQUEST [''content'']));

fclose($ file);

print' '< b>已保存< / b>< br />< hr />< br />'';


$ content = file_get_contents(basename( $ _SERVER [''SCRIPT_NAME''])。''。content'');

print $ content;

} else {

print''< form action ="''。$ _ SERVER [''PHP_SELF'']。''" method =" POST">'';

$ sBasePath =" fckeditor /" ;;

$ oFCKeditor = new FCKeditor(''content'');

$ oFCKeditor-> BasePath = $ sBasePath;

$ oFCKeditor->宽度= 660;

$ oFCKeditor->高度= 600;

$ oFCKeditor->值=的file_get_contents(基名($ _ SERVER [ '' SCRIPT_NAME '']) ''。内容 '');

$ oFCKeditor - >已启用= true;

$ oFCKeditor->创建();

print"< input type =''hidden''name =''thepassword ''value =''" 。 $ _REQUEST [''thepassword'']。 "''/>" ;;

print''< br />< input type =" submit"命名= [提交" value =" Save" />'';

print''< / form>'';

}

} elseif ($ _REQUEST [''mode''] ==''login''){

print''< b>请输入密码:< / b>'';

print''< form action ="''。$ _ SERVER [''PHP_SELF'']。''" method =" POST">'';

print''< input type =" password"命名= QUOT; thepassword" value ="" />'';

print''< br />< input type =" submit"命名= [提交" value =" Login" />'';

} else {

$ content = file_get_contents(basename($ _ SERVER [''SCRIPT_NAME''])。' '.content'');

打印$ content;

}

print''< br clear =" all" /> ;< br />< a href ="''。 $ _SERVER [''PHP_SELF'']。 ''?mode = login">'';

print''< font color =" #dddddd" size =" -2"> login< / font>< / a>'';

?> [/ PHP]


如果任何人都可以给我一个快速的选择,非常感谢,因为现在看来我可能需要重做我所有的客户网站,而我根本没有时间或人力来及时做到这一点方式。


谢谢!

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($_SERVER[''PHP_SELF'']) . ''<br>'';
$file = fopen(basename($_SERVER[''PHP_SELF'']) . ''.content'', ''w'');
fwrite($file,stripslashes($_REQUEST[''content'']));
fclose($file);
print ''<b>Saved</b><br/><hr/><br/>'';

$content = file_get_contents(basename($_SERVER[''SCRIPT_NAME'']) . ''.content'');
print $content;
}else{
print ''<form action="''.$_SERVER[''PHP_SELF''].''" method="POST">'';
$sBasePath = "fckeditor/";
$oFCKeditor = new FCKeditor(''content'') ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Width = 660;
$oFCKeditor->Height = 600;
$oFCKeditor->Value = file_get_contents(basename($_SERVER[''SCRIPT_NAME'']) . ''.content'');
$oFCKeditor->Enabled= true;
$oFCKeditor->Create();
print "<input type=''hidden'' name=''thepassword'' value=''" . $_REQUEST[''thepassword''] . "''/>";
print ''<br/><input type="submit" name="submit" value="Save"/>'';
print ''</form>'';
}
}elseif($_REQUEST[''mode'']==''login''){
print ''<b>Please enter password:</b>'';
print ''<form action="''.$_SERVER[''PHP_SELF''].''" method="POST">'';
print ''<input type="password" name="thepassword" value=""/>'';
print ''<br/><input type="submit" name="submit" value="Login"/>'';
}else{
$content = file_get_contents(basename($_SERVER[''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!

推荐答案

_REQUEST [''thepassword''] ==''password'')<如果((
_REQUEST[''thepassword''] == ''password'')
{
if((


_REQUEST [''content'']!='''')


{

print basename(
_REQUEST[''content'']!=''''))
{
print basename(


_SERVER [''PHP_SELF''])。 ''< br>'';
_SERVER[''PHP_SELF'']) . ''<br>'';


这篇关于解决fopen()命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆