use strict; use DBI; { my $user = 'someuser'; my $pass = 'somepass'; sub myconnect() { DBI->connect( 'dbi:ODBC:sometable',$user, $pass, {RaiseError=> +1}) or die DBI->errstr; # or whatever } } 1;
A cgi script should use lib "$path_to_home/lib"; and require "myconnect.pl";
Update: I should say how to finish this securely. The connection lib ~/lib/myconnect.pl must not be readable by other users. This is easiest to arrange (on Apache/*nix) if the suexec option is on for cgi and 'chmod 600 ~/lib/myconnect.pl'. The lib does not need to be executable, but must be readable by the cgi handler. Sorry, I'm not familiar enough with IIS to say how it should be set up there. ++crazyinsomniac, who is kindly teaching me to explain my posts better.
After Compline,
Zaxo
In reply to Re: CGI and Password security
by Zaxo
in thread CGI and Password security
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |