#!/usr/bin/perl # # ldpaddlink.cgi # requires perl5 and CGI module # # Use the CGI modules for HTML processing. # use CGI; use Carp; # Set the path for security and taint checking. # $ENV{'PATH'} = '/usr/bin:/bin'; # Create a new qry object for HTML form parsing. Get variables. # local($qry) = new CGI; local($email) = $qry->param('email') || ''; local($url) = $qry->param('url') || ''; local($ttl) = $qry->param('ttl') || ''; local($desc) = $qry->param('desc') || ''; local($ff) = $qry->param('ff') || ''; local(@ltype) = $qry->param('ltype'); local($ref_url) = $qry->referer() || 'http://tldp.org/links/index.html'; print $qry->header(); print "\nLDP: Add a Link\n", "\n", "

\n", "

LDP: Add a Link

\n"; # spam block # if( $ff ne '666' || $email =~ /link\-builder/i ) { print "ok

\n\n"; exit(0); } if( $email eq '' || $url eq '' || $ttl eq '' || (@ltype+0) == 0) { print "

Warning: Required field(s) are missing

\n"; } else { open(FP, "| /usr/lib/sendmail -oi -t") || do { print "

ERROR: cannot open link database. Contact ", "webmaster

\n", "\n\n"; exit(0); }; print FP "To: feedback\@en.tldp.org\n", "Subject: LDP link request\n\n", "\n", "${email}\n", "", join(", ", @ltype), "\n", "\n", "
  • ${ttl},\n", "${desc}
  • \n
    \n", "
    \n\n"; close(FP); print "

    The link information was successfully submitted.

    "; } print "

    Click here to go back to the ", "referring page.

    \n\n\n\n"; exit(0);