Third Quotation Type

Thread Solved

Join Date: Sep 2007
Posts: 1,497
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Third Quotation Type

 
0
  #1
Apr 11th, 2008
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:
  1. $cform = "<script type='text/javascript'>
  2. <!--
  3. function doubleSubmit(f)
  4. {
  5. // submit to action in form
  6. f.submit();
  7.  
  8. // set second action and submit
  9. f.action='index.php?act=addcomment';
  10. f.submit();
  11. return false;
  12. }
  13. //-->
  14. </script> <form action='$ip=$_SERVER[REMOTE_ADDR];
  15. $file=file_get_contents('ipLog.txt');
  16. if(substr_count($file, comment.' '.$ip)==0) {
  17. $file.='\n' . comment.' '.$ip;
  18. }
  19. file_put_contents('ipLog.txt', $file);
  20. $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
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 569
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: Third Quotation Type

 
0
  #2
Apr 11th, 2008
just escape the quotation marks you will need inside the first quotation mark:

  1. $x="this \" is a quote";
  2. echo $x;
Last edited by ryan_vietnow; Apr 11th, 2008 at 4:16 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,497
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: Third Quotation Type

 
0
  #3
Apr 11th, 2008
I have just tried your example but when I use the \", it skips the rest of the values in the variable. So it acted like a close quotation. Is there more to the example than just placing the \" after the action= or is there something I'm missing.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - MacGyver Fan
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,497
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 136
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: Third Quotation Type

 
0
  #4
Apr 12th, 2008
Sorry about the double post but I can't find the edit button.

I have found that it is impossible to do what I have asked. That is because there is only two quotation types and the computer gets confused when using a quotation type inside the same type of quotation type. However, it is possible to make this script record the info into a text file. It just needs to be placed in a different area. The script I provided in the first post is designed so that when the submit button is pressed, everything happens.

So what you need to do is make the 'comment' variable carry into the next page. Then when the new page loads (the redirect from pressing the button), you need to include in the header of the page the script that records into the text file and to get the variable 'comment' which has been carried into the next page. So basically, you can not have everything happens when clicking the button. In my case, I needed the script to be in the header of the next page with the variable carried to the next page. If you are having the same problem and don't understand this post then just pm me.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC