The following script is meant to write a file based on form input. The script works on the command line but not via CGI. I believe taint checking is to blame. As far a the security aspect this will only be used by me and be password protected so what is written is not a security concern.
#!/usr/bin/perl -w use strict; use CGI qw( param header); $q = new CGI; my $tela = $q->param('tela'); my $yoken = $q->param('yoken'); if ($tela eq undef) { print header; print <<SEIFORM; <HTML> <TITLE>seisei</TITLE> <body bgcolor="black" background="line.gif" alink="#ff9900" link="#ff9 +900" vlink="#ff9900" text="#ff9900"> <form action="seisei.cgi" method="get" name="seisei"> Tela:<input type="text" value="wiki" name="tela" align="top" maxlength="25" size="77"><br> <textarea name=yoken cols=70 rows=12>void</textarea> <BR> <input type="submit" value="kuppuku" align="middle"> </BODY> </HTML> SEIFORM } else { print header; print <<SUCCESS; <HTML> <TITLE>daiseikou</TITLE> <body bgcolor="black" background="line.gif" alink="#ff9900" link="#ff9 +900" vlink="#ff9900" + text="#ff9900"> <CENTER><H1>daiseikou</H1></CENTER> </BODY> </HTML> SUCCESS open(TELA, ">$tela.tela"); print TELA "$yoken"; print "$yoken"; }

Edit ar0n -- fixed


In reply to File writing script (taint mode problem?) by beretboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.