<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1013175" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1013175</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/db-using-flat-file-dynamic-content-html#comment-1076728</link>
    <description> &lt;p&gt;What can someone do with the script tag when it comes to opening a file?&lt;/p&gt;
 </description>
     <pubDate>Sun, 14 Jan 2001 21:06:06 +0000</pubDate>
 <dc:creator>Vorm</dc:creator>
 <guid isPermaLink="false">comment 1076728 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/db-using-flat-file-dynamic-content-html#comment-1076518</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: &lt;em&gt;Originally posted by spragueg &lt;/em&gt;&lt;br /&gt;
&lt;strong&gt;It&#039;s always the same file but the user is requesting data via forms or action tags. I have a parsing lib that gets my pairs out. Should I use the regexp there?  For example I have a variable like &quot;words=01234&quot; passed via the url or form. If I read that regexp right it&#039;s looking for any &quot;/&quot; and replacing it with nothing? So should I do $words= s/\///g; before I open my file? Do I understand?&lt;br /&gt;
 &lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;It depends on the method used to parse. I urge the use of the CGI perl module. It&#039;s a little heavy on compile times, but worth it for it&#039;s clean and easy to use interface.&lt;/p&gt;
&lt;p&gt;Always do some kind of data checking on parsed value=pairs tags.&lt;/p&gt;
&lt;p&gt;I&#039;d use something like:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;sub CleanValue {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; my ($obj, $Tmp) = @_;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s!\0!!g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; my %ENT=(&amp;#039;&amp;amp;&amp;#039;=&amp;gt;&amp;#039;amp&amp;#039;,&amp;#039;&amp;lt;&amp;#039;=&amp;gt;&amp;#039;lt&amp;#039;,&amp;#039;&amp;gt;&amp;#039;=&amp;gt;&amp;#039;gt&amp;#039;,&amp;#039;&amp;quot;&amp;#039;=&amp;gt;&amp;#039;quot&amp;#039;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s!([&amp;amp;&amp;lt;&amp;gt;&amp;quot;])!&amp;amp;$ENT{$1};!sg;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|&amp;lt;!--|&amp;amp;#60;&amp;amp;#33;&amp;amp;#45;&amp;amp;#45;|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|--&amp;gt;|&amp;amp;#45;&amp;amp;#45;&amp;amp;#62;|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|&amp;amp;lt;script&amp;amp;gt;|&amp;amp;#60;&amp;amp;#115;&amp;amp;#99;&amp;amp;#114;&amp;amp;#105;&amp;amp;#112;&amp;amp;#116;&amp;amp;#62;|ig;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|^\$+$|&amp;amp;#36|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s!\|!&amp;amp;#124;!g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|\{|&amp;amp;#123;|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|\}|&amp;amp;#125;|g; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|\,|&amp;amp;#44;|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|\*|&amp;amp;#42;|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|&amp;#039;|&amp;amp;#39;|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|\s+$||g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|\$|&amp;amp;#36|g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Tmp =~ s|\r||g;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $Tmp;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Wed, 10 Jan 2001 02:48:47 +0000</pubDate>
 <dc:creator>Matt@Ikonboard</dc:creator>
 <guid isPermaLink="false">comment 1076518 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/db-using-flat-file-dynamic-content-html#comment-1076517</link>
    <description> &lt;p&gt;Focusing on opening files from user input, I&#039;d go full on taint.&lt;/p&gt;
&lt;p&gt;Something like:&lt;/p&gt;
&lt;p&gt;my $File = $q-&amp;gt;param(&#039;file&#039;);  #or however the data is parsed..&lt;/p&gt;
&lt;p&gt;$File = CleanFilename($File);&lt;br /&gt;
open FH, $File or die $!;&lt;br /&gt;
.....&lt;/p&gt;
&lt;p&gt;#Some where in a script/lib/module - whatever&lt;/p&gt;
&lt;p&gt;sub CleanFilename {&lt;br /&gt;
    die &quot;Illegal Characters&quot; unless  $_[0] =~ m!^([\w.-]+)$!;&lt;br /&gt;
    return $1;  # $1 is now untainted&lt;br /&gt;
}&lt;/p&gt;
 </description>
     <pubDate>Wed, 10 Jan 2001 02:44:30 +0000</pubDate>
 <dc:creator>Matt@Ikonboard</dc:creator>
 <guid isPermaLink="false">comment 1076517 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/db-using-flat-file-dynamic-content-html#comment-1076476</link>
    <description> &lt;p&gt;I should have been more clear sorry. the regexp is only neccesary when you are opening a file inputed by the user.&lt;/p&gt;
 </description>
     <pubDate>Tue, 09 Jan 2001 02:29:42 +0000</pubDate>
 <dc:creator>Rob Pengelly</dc:creator>
 <guid isPermaLink="false">comment 1076476 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/db-using-flat-file-dynamic-content-html#comment-1076475</link>
    <description> &lt;p&gt;It&#039;s always the same file but the user is requesting data via forms or action tags. I have a parsing lib that gets my pairs out. Should I use the regexp there?  For example I have a variable like &quot;words=01234&quot; passed via the url or form. If I read that regexp right it&#039;s looking for any &quot;/&quot; and replacing it with nothing? So should I do $words= s/\///g; before I open my file? Do I understand?&lt;/p&gt;
 </description>
     <pubDate>Tue, 09 Jan 2001 01:15:07 +0000</pubDate>
 <dc:creator>spragueg</dc:creator>
 <guid isPermaLink="false">comment 1076475 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/db-using-flat-file-dynamic-content-html#comment-1076459</link>
    <description> &lt;p&gt;It really depends on the situation.  Is thie file that you are opening already defined in your script?&lt;br /&gt;
ie-&lt;br /&gt;
$file = &#039;data.txt&#039;;&lt;br /&gt;
open(IN,$file) or die &quot;Can&#039;t open $file: $!\n&quot;;&lt;br /&gt;
If this is the case, you are fine, because you will only open the specified file.&lt;/p&gt;
&lt;p&gt;Or, are you getting userinput first, and opening a file a specific file depending on the users input?  If this is the case, it is always good to write a small regexp (Regular Expression) to make sure there are no &#039;/&#039; in the inputed variable.  I usually use:&lt;br /&gt;
$foo = s/\///g;&lt;/p&gt;
 </description>
     <pubDate>Mon, 08 Jan 2001 20:49:26 +0000</pubDate>
 <dc:creator>Rob Pengelly</dc:creator>
 <guid isPermaLink="false">comment 1076459 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
