Hello all,
The way I have set up my program worries me. I'm not sure if its the safe/good way to go or if its just perfectly fine.
Basically I have two files. 1.) user.pl 2.) verify.pl
user.pl code:
#!C:/Perl/bin/perl.exe -wT
print "Content-type: text/html\n\n ";
my $auth_file = 'auth.pl';
require "$auth_file";
&startup;
my $action = $INPUT->param('action');
if (length($action) > 15) {
print "Invalid Action! Your IP has been logged and will be inves
+tigated further.";
die;
}
if ($action eq "login") { &login; }
elsif ($action eq "auth") { &auth; }
elsif ($action eq "logout") { &logout; }
else { &signup; }
auth.pl code (only the startup function displayed):
sub startup {
use CGI qw/:standard/;
#notice how theres no 'my' next to INPUT, so it can be global for the
+user.pl to use
$INPUT = new CGI;
use strict;
}
I don't know why but the following set up just worries me? Shouldn't use strict be declared before use CGI?
If I do that however, then I can't make the $INPUT global?
Am I using require just fine? The thing that makes me a little upset is my inability to understand full concepts when I read something. For example, I usually learn through examples and tutorials, but even though I can get something to work out , there still efficiency/security flaws that I wouldn't know of. An example of this is how I learned how to used fetchrow_hashref to retreive 1000 rows, even though bind_col was the most efficient way to do so.
thanks
tanger
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.