Re: Session management

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

 



* Thus wrote Herman Scheepers:
> Hi
> 
> I am a PHP newbie from a Java/C/Oracle background. I
> cannot seem to get session management with PHP
> working.
> 
> <?php
> 
>   #echo 1;
> 
>   $old = ini_set('session.use_cookies', 0);
> 
>   session_start();
>   $username = $_REQUEST["username"];
>   session_register($username);

session_register() shouldn't be used, it relys on the php ini
setting register_globals to be on. As Tom pointed out you simply
just need to set the session var like:

  session_start();
  $username = $_REQUEST["username"];
  $_SESSION['username'] = $username;

> In ht_next.php I have:
> 
> <?php
> 
> 
>   session_start();
>   
>   echo $username;

And here:
   session_start();
   $username = $_SESSION['username'];
   echo $username;


Curt
-- 
Quoth the Raven, "Nevermore."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux