<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1022025" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1022025</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/etc-values-inserting-mysql#comment-1135774</link>
    <description> &lt;p&gt;I&#039;ve not used mysql_escape_string().  My only concern would be using the string in non-mysql related operations as I don&#039;t know what to expect.&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 20:23:49 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1135774 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/etc-values-inserting-mysql#comment-1135771</link>
    <description> &lt;p&gt;Hi Mark,&lt;/p&gt;
&lt;p&gt;Thanks that looks closer to what I had in mind. I recently came up with this... what do you think?&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;if (!&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;get_magic_quotes_gpc&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;()) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_POST &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;as &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$k&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$v&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$k&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;] = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_escape_string&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$v&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;???&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 20:12:45 +0000</pubDate>
 <dc:creator>KandieMan101</dc:creator>
 <guid isPermaLink="false">comment 1135771 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/etc-values-inserting-mysql#comment-1135769</link>
    <description> &lt;p&gt;METHOD 1 - Not advisable.  If you strip slashes when magic_quotes_gpc is off, you may be stripping slashes that are part of the data, and not part of PHP escaping characters.&lt;/p&gt;
&lt;p&gt;METHOD 2 - I&#039;ve never seen a server that allows you to effectively set this at run time.  By the time the first line of PHP is interpreted, the interpreter has already escaped all GPC data (assuming magic_quotes_gpc is on).&lt;/p&gt;
&lt;p&gt;So whats a guy/gal to do?  (not tested)&lt;br /&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;set_magic_quotes_runtime&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&lt;br /&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;fix_slashes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;get_magic_quotes_gpc&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;()) return &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$arr &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;as &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;is_array&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)) &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;] = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;fix_slashes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;] = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;addslashes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$GLOBALS &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;fix_slashes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;I have no idea why you&#039;re using rawurldecode() or htmlentities().&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 19:55:59 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1135769 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/etc-values-inserting-mysql#comment-1135749</link>
    <description> &lt;p&gt;hmmm... if i&#039;m not mistaken the only issues are null byte,s, single quotes, double quotes and backslashes...which means by the time it gets to addslashes, the only one i might have left is the backslashes...&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 14:58:29 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135749 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/etc-values-inserting-mysql#comment-1135747</link>
    <description> &lt;p&gt;first grab the info.&lt;br /&gt;
then strip the slashes. then do any cleaning you want of the data prior to inserting it into the mysql db&lt;br /&gt;
then use addslashes. that&#039;s what it&#039;s there for.&lt;/p&gt;
&lt;p&gt;edit:&lt;br /&gt;
my cleaning statement does all that at once:&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;function &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;clean&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userInput&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userInput&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;addslashes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;htmlentities&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;stripslashes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;rawurldecode&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userInput&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)), &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;ENT_QUOTES&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;));&lt;br /&gt;&amp;nbsp;&amp;nbsp; return &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userinput&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 14:48:16 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135747 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/etc-values-inserting-mysql#comment-1135720</link>
    <description> &lt;p&gt;What problems are you having putting the data in?&lt;/p&gt;
&lt;p&gt;I find putting it into TEXT fields I just put the data in. Sometimes when I need to put it in and take it out, edit it and put it back in, I will use PHP to maintain special HTML entities, but I&#039;ve never worried about bits like semi-colons or single quotes or back-slashes. Perhaps erroneously!&lt;/p&gt;
&lt;p&gt;Of course, I haven&#039;t done a lot of protection work with the data because I work mostly with off-web intranets or passworded areas. &lt;/p&gt;
&lt;p&gt;This is from my comments script, originally from Stephanie at &lt;a href=&quot;http://www.climbtothestars.org/coding/comments/&quot; class=&quot;bb-url&quot;&gt;http://www.climbtothestars.org/coding/comments/&lt;/a&gt; (see her site for the original code). I added the url bit and something else that I can&#039;t remember, but may not be in this section, anyway. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&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; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//clean up the message text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$name &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;strip_tags&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// remove all tags&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$name &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;htmlspecialchars&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// remove all bad characters&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$text&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$message &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;strip_tags&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&amp;lt;strong&amp;gt;&amp;lt;em&amp;gt;\&quot;); // remove all tags except ...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = ereg_replace(\&quot;[[:alpha:]]+://[^&amp;lt;&amp;gt;[:space:]]+[[:alnum:]/]\&quot; ,\&quot;&amp;lt;a href=\\&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;\\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&amp;gt; \\0&amp;lt;/a&amp;gt;\&quot;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;); // this makes URLs active hyperlinks&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (get_magic_quotes_gpc()) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = stripslashes(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = stripslashes(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 04:48:06 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1135720 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
