I have a perl script in cgi-bin and I only want my server to be able to run it. When I type the address into a browser it executes the script. How can I make it so it can only run from calls to it that originate on my server.
#!/usr/bin/perl -T use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; # load cgi (functions for using forms a +nd generating HTML) $CGI::POST_MAX=10240; # limit data to 10k $CGI::DISABLE_UPLOADS =1; # prevent file uploads with this script + :/ use Fcntl qw(:flock); # file lock used by the order counter my $serv = $ENV{'SERVER_NAME'}; my $ip = $ENV{'REMOTE_ADDR'}; my $brow = $ENV{'HTTP_USER_AGENT'}; my $ref = $ENV{'HTTP_REFERER'}; $ENV{PATH} = "/usr/sbin/sendmail -t -i"; #for sendmail

In reply to prevent perl script running from browser by snowchild

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.