PHP server session variables

Rodolfo Alcazar rodolfo.alcazar at padep.org.bo
Wed Feb 22 14:26:46 UTC 2006


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

Gruß!
--
Rodolfo Alcazar - rodolfo.alcazar at padep.org.bo
Netzmanager Padep, GTZ
591-70656800, -22417628, LA PAZ, BOLIVIA
http://otbits.blogspot.com
--
A 'debugged' program that crashes will wipe out source files on storage
devices when there is the least available backup.





More information about the users mailing list