Hi and for the past 4 days, I have been trying to make a secure spam-proof blog with no login. I manage to embed a lot into a demo but the following code I know works (as I have made it work on my forum login) but has an error with the quotation marks. I know exactly why but don't have a clue on how to solve it. The code contains php, javascript and html but it is the php which has the quotation problems. So the code is:
$cform = "<script type='text/javascript'>
<!--
function doubleSubmit(f)
{
// submit to action in form
f.submit();
// set second action and submit
f.action='index.php?act=addcomment';
f.submit();
return false;
}
//-->
</script> <form action='$ip=$_SERVER[REMOTE_ADDR];
$file=file_get_contents('ipLog.txt');
if(substr_count($file, comment.' '.$ip)==0) {
$file.='\n' . comment.' '.$ip;
}
file_put_contents('ipLog.txt', $file);
$total=substr_count($file, '\n');' method='post' onsubmit='doubleSubmit(this)'>"
And it goes further on but that is the main part to be focused on. On the first line you will see
$cform = "
In that line you will notice a quotation mark. That quotation mark needs to surround everything related to that variable so it can be used later on. But that uses one type of quotation. Then you will see an action= event. This also needs to be surrounded in quotation marks. But when it comes to adding the quotation marks for the strings in the action event, I have nothing left to use. So basically a third type of quotation mark is needed.
I have tried using brackets and removing some quotation marks to try and reduce the number of quotation marks needed but has not been successful. So does anyone have a clue on how to have a third quotation mark or how to reduce the number of types needed. Although I am new to php I am understanding it very well. Any help would be appreciated.
Thanks