p3ptools
Posts: 19
|
Posted: 04/28/2004, 1:30 PM |
|
Hello,
On *nix systems it is quite possible to mix both code charge generated PHP with
external Perl utilities to accomplish tasks such as PDF generation etc..
Cpan module
PHP::Session
should be installed. Note this is only a Perl module,
mod_perl or other objects that have implications for Apache and CGI are not required.
a sub-module provides a mechanism for un-serializing session files.
Here is a small snippet of code.
<CODE>
use strict;
use CGI;
use PHP::Session::Serializer::PHP;
use DBI;
my $query = new CGI;
my $serializer = PHP::Session::Serializer::PHP->new;
my $SESSIONID=$query->param('SESSIONID');
my $session_file = "/tmp/sess_" . $SESSIONID;
my $session;
my $UserLogin;
my $UserID;
my $sh;
open(S,"$session_file");
$session=<S>;
close(S);
$sh=$serializer->decode($session);
$UserLogin=$sh->{UserLogin};
$UserID=$sh->{UserID};
</CODE>
The variables $UserLogin and $UserID can then be
tested and compared against your database to
ensure that your Perl program is still running within the
session environment.
If your authentication tests fail then just redirect the browser
to your login page, (ala code charge - session verification).
I hope this is useful!
Stephen.
_________________
Sometimes the complaints will be false... |
|
|
|