[eluser]Fr3aked0ut[/eluser]
Hi, I'm having a problem with script in a textarea.
Let's say I have this code in the textarea:
Code:
[removed][removed]
Some HTML CODE
And when clicking "Send" button, I'm writing this code to a file:
Code:
$file = APPPATH. 'views/'. $this->template. '/'. strtolower($this->skin). '.php';
$Data = stripslashes( $_POST['data'] );
if ( is_writeable($file) )
{
$f = fopen($file, 'w+');
if ($f !== FALSE)
{
$Data = str_replace("<", "<", $Data);
$Data = str_replace(">", ">", $Data);
$Data = preg_replace("#<if=\"(.+?)\">\n(.+?)\n</if>#is", "if(\\1)\n{\n\\2\n}", $Data);
$Data = preg_replace("#<else>\n(.+?)\n</else>#is", "else\n{\n\\1\n}", $Data);
$Data = str_replace("[php]", "<?php", $Data);
$Data = str_replace("[php]", "<?", $Data);
$Data = str_replace("[/php]", "?>", $Data);
fwrite( $f, $Data );
}
fclose($f);
$mess = "Well done";
}
else
{
$mess = "An error";
}
Now, when I'm saving it, the script area is changing to [remove][remove].
I dont know why, maybe you can help me.
Thanks alot!!