Jump to content

session security stuff


jk11uk

Recommended Posts

Not really.

 

echo "$_SESSION[user]";

 

works, while

 

echo "$_SESSION['user']";

 

wouldn't.

 

I believe you that it somehow works in your application, but he's right about the syntax. If the key is anything other than a numerical index, the key String should be quoted as such. To echo in quotes without concatenating, or saving the session var into a simpler var like $user = $_SESSION['user'], then echoing, you can use this syntax (I forget the name):

 

echo "{$_SESSION['user']}";

 

works for all arrays such as:

 

echo "favorite browser is {$browsers['favorite']}, while the worst is {$browsers['worst']}";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.