Re: PHP server session variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-22-02 at 10:26 -0400, Rodolfo Alcazar wrote:
> On Tue, 2006-02-21 at 18:14 +0100, Zoltan Ganyecz wrote:
> > 2006-02-21, k keltezéssel 12.28-kor Rodolfo Alcazar ezt írta:
> > > You're right, but the file is a mess. If there is no any other option, I
> > > must grep/cut/sed the file and get the variables I need.
> > 
> > Try this: create a file named 'read_session_vars.php':
> > 
> > <?php
> > $id = ereg_replace( '^sess_?','',basename( $_SERVER['argv'][1] ) );
> > session_id( $id );
> > session_start();
> > print_r( $_SESSION );
> > ?>
> > ..then run with php:
> > $: /usr/bin/php -f read_session_vars.php /where/session/file/is
> 
> Perfect! Just what I need! 
> 
> # cat ./phpsessions.php
> #!/usr/bin/php
> <?
>    $id=ereg_replace('^sess_?','',basename($_SERVER['argv'][1]));
>    session_id($id);
>    session_start();
>    print_r($_SESSION);
> ?>
> # ./phpsessions.php /tmp/sess_1c980584f91034536be7590029ee731d|less
> 
There are some examples around that show how to store session
data in other files and even in databases, but most things that 
are posted are somewhat incomplete. I have written MySQL and 
PostgreSQL "libraries" for projects at work but I am not allowed 
to publish the completed work. The online examples are OK but 
for the most part the garbage collection is poor or non existant.

If you have multiple customers using PHP on a single server, it 
is a good idea to use per site storage locations for session 
files for security and liability reasons.

Have a good day.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux