View Single Post
  #1  
Old 06-04-2012, 04:25 PM
saeeded saeeded is offline
New Member
 
Join Date: Jun 2012
Posts: 2
Default 403 error for save <SCRIPT> into file on the server

hi and sorry for my English
i write an small application by PHP that read/write html/or/txt file by simple form.
.
its worked as well until server updated by litespeed protection method.
.
here it is my code ------> do.php
PHP Code:
<?php
// set file to read
$filename "xx.txt";
  
$newdata $_POST['newd'];

if (
$newdata != '') {

// open file 
$fw fopen($filename'w') or die('Could not open file!');
// write to file
// added stripslashes to $newdata
$fb fwrite($fw,stripslashes($newdata)) or die('Could not write to file');
// close file
fclose($fw);
}
 
?>
and by this form i get data to store into "xx.txt" file :

PHP Code:
<?php
$filename 
"xx.txt"
$fh fopen($filename"r") or die("Could not open file!");
$data fread($fhfilesize($filename)) or die("Could not read file!");
?>
<html>
<form action='do.php' method= 'post' >
<textarea name='newd' cols='100%' rows='50'><?php print $data ?> </textarea>
<input type='submit' value='Save Data'>
</form>
</html>
its will accept all character or html tags by this form and will stored into TXT file, but when i want to save <script> character alone or middle html tags, litespeed return error

403 Forbidden
" Access to this resource on the server is denied!"
Powered By LiteSpeed Web Server
....
.
this 403 error will not reported apache error logs.
how can i resolve this problem ?!

thanks for your attention.
Reply With Quote