Re: [PHP] Understanding session variables with input field and register_global
Hello, Can you send your code? I can help you :) -- Haydar TUNA Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net ""Jay Blanchard"" <[EMAIL PROTECTED]>, haber iletisinde sunlari yazdi:[EMAIL PROTECTED] [snip] I've an input field in a form http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Understanding session variables with input field and register_global
On Tue, February 20, 2007 10:32 am, Otto Wyss wrote: > I've an input field in a form > > > and with register_global I can use this field in PHP as variable > $username. You really really should turn OFF register_global for new code development... > Yet if I use a session variable > > $_SESSION['username'] = 'value' > > the variable $username gets the same value. On the other side when I > enter a value in the input field, the session variable isn't changed. > So > how can I set the session variable from the input field after it has > changed? If you want to sort out the mess of which variables are coming from where, use $_POST and $_SESSION and $_GET instead of $username You should not blindly put POST/GET data into your SESSION data. NEVER trust user-supplied data. Start reading about that here: http://phpsec.org/ > > O. Wyss > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Understanding session variables with input field and register_global
> -Original Message- > From: Otto Wyss [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 20, 2007 11:32 AM > To: php-general@lists.php.net > Subject: [PHP] Understanding session variables with input field and > register_global > > I've an input field in a form > > > and with register_global I can use this field in PHP as variable > $username. Yet if I use a session variable > > $_SESSION['username'] = 'value' > > the variable $username gets the same value. On the other side when I > enter a value in the input field, the session variable isn't changed. So > how can I set the session variable from the input field after it has > changed? > > O. Wyss > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > I'm not familiar with an ini setting such as register_globals that would give you similar functionality with session variables. IMHO it seems unlikely that anyone would want EVERY form variable saved in the session (Like the value of your "Submit" button :P)... .. but if you REALLY want to do it, you could do something like this: foreach($_POST as $key => $val) { $_SESSION[$key] = $val; } HTH, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Understanding session variables with input field and register_global
2007. 02. 20, kedd keltezéssel 17.32-kor Otto Wyss ezt írta: > I've an input field in a form > > > and with register_global I can use this field in PHP as variable > $username. Yet if I use a session variable > > $_SESSION['username'] = 'value' > > the variable $username gets the same value. the manual says ( http://hu.php.net/manual/en/ref.session.php ) "If register_globals is enabled, then the global variables and the $_SESSION entries will automatically reference the same values which were registered in the prior session instance. However, if the variable is registered by $_SESSION then the global variable is available since the next request." that's why it is the same I think you should read the value from $_POST and put it into $_SESSION to change it hope that helps Zoltán Németh > On the other side when I > enter a value in the input field, the session variable isn't changed. So > how can I set the session variable from the input field after it has > changed? > > O. Wyss > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Understanding session variables with input field and register_global
[snip] I've an input field in a form http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Understanding session variables with input field and register_global
I've an input field in a form and with register_global I can use this field in PHP as variable $username. Yet if I use a session variable $_SESSION['username'] = 'value' the variable $username gets the same value. On the other side when I enter a value in the input field, the session variable isn't changed. So how can I set the session variable from the input field after it has changed? O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php