<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1023157" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1023157</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142590</link>
    <description> &lt;p&gt;The threat is really to the site, not the database -- corrupted information coming out. The data, however, is at risk as well as most databases will &quot;fix&quot; anything that&#039;s going to hurt them, and there are some other issues with the database cutting off data if you have the fields set badly.&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Dec 2003 19:34:59 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1142590 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142585</link>
    <description> &lt;p&gt;&quot;For instance they could open an &lt;a&gt; tag and not close it, then all the text on the page would link where they wanted.&quot;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;    In this case, they are creating their own site, so I don&#039;t have a problem with it. I may consider stripping and replacing tags though, as Suzanne suggested.&lt;/p&gt;
&lt;p&gt;   Any threat to the database by leaving the tags/javascript in there? That&#039;s my main concern. &lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;TM&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Dec 2003 18:44:04 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1142585 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142580</link>
    <description> &lt;p&gt;Yes, they definitely can. Stripping out tags and replacing them with your own codes can help, or just removing all tags (like comment scripts do).&lt;/p&gt;
&lt;p&gt;In general it&#039;s better to keep the data clean from all markup except semantic tags like &lt;strong&gt; and &lt;em&gt;, which do not influence anything other than the appearance and meaning of the data.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Dec 2003 16:11:54 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1142580 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142548</link>
    <description> &lt;p&gt;I believe they can. For instance they could open an &lt;a&gt; tag and not close it, then all the text on the page would link where they wanted. Not good for your site. Also, javascript can be used to manipulate DOM so they could pop up windows, redirect users elsewhere and all sorts.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Its best to remove the html where ever possible.&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Dec 2003 09:28:46 +0000</pubDate>
 <dc:creator>andy206uk</dc:creator>
 <guid isPermaLink="false">comment 1142548 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142538</link>
    <description> &lt;p&gt;Thanks for the info, Suzanne. Can a user do anything malicious by entering HTML/javascript into a database through a form?&lt;/p&gt;
 </description>
     <pubDate>Fri, 12 Dec 2003 06:28:48 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1142538 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142469</link>
    <description> &lt;p&gt;In order to protect the data as much as possible from the tampering of the  and  crew, I don&#039;t allow HTML into the database normally. Instead, when the data is displayed, I add the markup then.&lt;/p&gt;
&lt;p&gt;It&#039;s especially useful for paragraphs, but can also work for anchors and other markup. &lt;/p&gt;
&lt;p&gt;Dean Allan has something like this going for his CMS project -- &lt;a href=&quot;http://www.textism.com/tools/textile/&quot; class=&quot;bb-url&quot;&gt;http://www.textism.com/tools/textile/&lt;/a&gt; -- but I think it goes into the database as markup, though standardized markup.&lt;/p&gt;
&lt;p&gt;On the way in, I can (and sometimes do) change things to the correct HTML entities for things like degrees and quotes, however I also do this:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $care &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;str_replace&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;\n\r\n\&quot;,\&quot;&amp;lt;/p&amp;gt;\n\n&amp;lt;p&amp;gt;\&quot;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$care&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$care&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = str_replace(\&quot;‘[^&amp;gt;]*’\&quot;,\&quot;&amp;amp;#8216;[^&amp;gt;]*&amp;amp;#8217;\&quot;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$care&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$care&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = str_replace(\&quot;°\&quot;,\&quot;&amp;amp;#176;\&quot;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$care&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;And then to display it for real:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;echo \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$care&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&amp;lt;/p&amp;gt;\&quot;;&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Which puts the beginning and end on.&lt;/p&gt;
&lt;p&gt;Better ways are welcome, please don&#039;t hesitate to cut this apart.&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Dec 2003 16:20:39 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1142469 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142449</link>
    <description> &lt;p&gt;Wow... cool function. I didnt know that existed. I&#039;ve been doing &lt;code&gt;eregi_replace(&amp;quot;\n&amp;quot;,&amp;quot;&amp;lt;br&amp;gt;&amp;quot;,&amp;quot;$string&amp;quot;);&lt;/code&gt;&#039;&lt;/p&gt;
&lt;p&gt;Must remember that one!&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Dec 2003 12:24:24 +0000</pubDate>
 <dc:creator>andy206uk</dc:creator>
 <guid isPermaLink="false">comment 1142449 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142441</link>
    <description> &lt;p&gt;&quot;Depending on the application, it&#039;s better to create new paragraphs on output, not put the information into the database with the markup attached, btw.&quot;&lt;/p&gt;
&lt;p&gt;   Can you elaborate more on that? In one case, the user has the ability to write their own HTML which is stored in a database. It&#039;s dynamically written to an HTML window when retrieved for viewing. I just want to make sure nothing malicious makes its way into the database.&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Dec 2003 05:28:42 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1142441 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142435</link>
    <description> &lt;p&gt;When a form is submitted, it returns some hidden characters for new lines and carriage returns. Often the format is \n\r -- new line, carriage return.&lt;/p&gt;
&lt;p&gt;This is what&#039;s tested for, it&#039;s not something the user enters. The user just presses return or enter and creates a visual new line.&lt;/p&gt;
&lt;p&gt;Depending on the application, it&#039;s better to create new paragraphs on output, not put the information into the database with the markup attached, btw.&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Dec 2003 03:38:55 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1142435 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-auto-br#comment-1142429</link>
    <description> &lt;p&gt;Does a message board text area like this one detect new lines in the same manner? If I can avoid telling the client: put \n for every new line I&#039;d like to.&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Dec 2003 00:28:56 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1142429 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
