您好我正在尝试建立我的网站。最初的 php 工作得非常好。我可以从 db 中获取选择值。当我单击提交按钮时,我得到
Forbidden
You don't have permission to access / on this server.
错误。提交按钮使用 POST $_SERVER['REQUEST_URI'] 并且它使用相同的 php 并在 tinymce 富文本框中添加/更改值,如下所示。
<script language="javascript" type="text/javascript">
function initMCEexact(e){
tinyMCE.init({
theme : "advanced",
mode: "exact",
elements : e,
theme_advanced_toolbar_location : "top",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,"
+ "justifyleft,justifycenter,justifyright,justifyfull,formatselect,"
+ "bullist,numlist,outdent,indent,preview,print",
theme_advanced_buttons2 : "link,unlink,anchor,image,separator,"
+"undo,redo,cleanup,code,separator,sub,sup,charmap",
theme_advanced_buttons3 : "",
height:"800px",
width:"100%",
plugins: "print,preview",
toolbar: "print,preview"
});
}
initMCEexact("elm1");
</script>
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
<textarea id="elm1" name="elm1" rows="15" cols="80" width="100%"><?php echo $sContent;?></textarea>
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
它张贴在表格的一面
if(isset($_POST['elm1']) || isset($_POST["btn-upload"])) {
if(isset($_SESSION['sContent'])){
$sContent=$_SESSION['sContent'];
}
$sContent = strip_tags(stripslashes($_POST['elm1']),$allowedTags);
if(isset($_SESSION['id']) && isset($_SESSION['name'])){
$sql="INSERT INTO kopru (kopruid, kopruadi, html) VALUES('$kopruid', '$kopruname', '$sContent') ON DUPLICATE KEY UPDATE kopruadi=VALUES(kopruadi), html=VALUES(html)";
mysqli_query($conn,$sql);
}
if(isset($_SESSION['sContent'])){
$_SESSION['sContent']=$sContent;
}
}
它在本地 wamp 服务器上运行良好。
我使用 cpanel 作为面板。