james438
10-05-2010, 06:19 PM
On my site I have many different options for formatting text documents. I use CSS to put select quoted text into colored boxes, text links are hyperlinked, code is properly formatted when put in code tags, and a few other goodies. I do this for my own benefit.
I am now working on a bigger project where users can log into my site and create articles of their own. I am not too worried about security as I feel fairly comfortable with my knowledge of security safeguards, but I am sure there is still much I need to learn. In fact it is partly due to this that I am having a bit of trouble.
I am trying to figure out how an article should be processed. A user will create a document and submitted to the database. I do not want the user to be able to submit javascript that will be executed after being retrieved from the database. Is there a way to disable the javascript? Should I echo the html entities when it is retrieved from the database or before it is submitted to the database? I want to be able to process certain tags like bold, anchors, my premade quote tags and code tags using square brackets, but I want <b> to be displayed as <b>. whereas
text will be displayed as text.
Basically, I want to disable javascript hacking. I hope I am making some sense. For the rest I figure a simple str_replace will take care of most issues.
I am now working on a bigger project where users can log into my site and create articles of their own. I am not too worried about security as I feel fairly comfortable with my knowledge of security safeguards, but I am sure there is still much I need to learn. In fact it is partly due to this that I am having a bit of trouble.
I am trying to figure out how an article should be processed. A user will create a document and submitted to the database. I do not want the user to be able to submit javascript that will be executed after being retrieved from the database. Is there a way to disable the javascript? Should I echo the html entities when it is retrieved from the database or before it is submitted to the database? I want to be able to process certain tags like bold, anchors, my premade quote tags and code tags using square brackets, but I want <b> to be displayed as <b>. whereas
text will be displayed as text.
Basically, I want to disable javascript hacking. I hope I am making some sense. For the rest I figure a simple str_replace will take care of most issues.