Solved

cannot store / write sessions

Posted on 2008-06-16
2
186 Views
Last Modified: 2010-04-21
Hi

I'm trying to set sessions based on the post then use them later, any idea why this does not work.... and is this a security risk?

if it is a rick, are there better ways or something else I should add to check on

Thanks
Neil

session_start();
foreach ($_POST as $var => $val) {
   $_SESSION[$var] == $val;
   echo $_SESSION[$var];
}
0
Comment
Question by:NeilT
2 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 21793787
It is not a securiry risk per say.

As your example. You have a equal sign to many. It should be:
session_start();
foreach ($_POST as $var => $val) {
   $_SESSION[$var] = $val;
   echo $_SESSION[$var];
}
0
 
LVL 3

Author Closing Comment

by:NeilT
ID: 31467606
thanks
Neil
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now