Need quick help with Sessions

Discussion in 'PHP' started by zerxer, Jan 25, 2009.

  1. #1
    Okay, so this site I made uses multi-dimensional arrays for session cookies. It was working perfectly fine on my client's old server. I sold the same script to someone else and it wasn't working properly on that person's shared server. My first client then got a new dedicated server and just moved there and now he's having the same problem as the second.

    Here's what I'm trying to do:
    $_SESSION['unique_id'][$site->act] = $unique_id;

    ($site->act is properly set, it's just $_GET['act'] basically. $unique_id is set too)

    Here's what the $_SESSION array turns into:
    Array ( [unique_id] => the_unique_id )

    It's not making it multi-dimensional. However, if I do something like this:
    $_SESSION['admin'] = array("username"=>"foo", "password=>"bar", "id"=>1);

    It properly turns into this still:
    Array ( [admin] => Array ( [username] => foo, [password] => bar, [id] => 1 )


    Is there some setting in php.ini that I can modify that'll make the first way work correctly?

    Thanks!


    EDIT: Nevermind! I figured it out. It seems register_globals was set to on and this was making it all wonky. Found it out due to the $unique_id variable being output as "Array" when printed to the page (it was trying to print $_SESSION['unique_id'] due to super globals). What a very messy feature. Glad it was removed in PHP 6.
     
    zerxer, Jan 25, 2009 IP