Reply to Re: [PHP] session_name("CCLTrolley")

Your name:

Reply:


Posted by Robert Cummings on 10/02/05 07:33

On Sun, 2005-10-02 at 00:32, John Taylor-Johnston wrote:
> > <?php
> >
> > session_name( 'CCLTrolley' );
> > session_start();
> >
> > //
> > // Initialize the trolley.
> > //
> > if( !isset( $_SESSION['TrolleyContents'] ) )
> > {
> > $_SESSION['TrolleyContents'] = '';
> > }
> >
> > //
> > // Add new entry.
> > //
> > if( isset( $_POST['AddToTrolley'] ) )
> > {
> > if( $_SESSION['TrolleyContents'] ) == '' )
> > {
> > $_SESSION['TrolleyContents'] = $_POST['AddToTrolley'];
> > }
> > else
> > {
> > $_SESSION['TrolleyContents'] .= ','.$_POST['AddToTrolley'];
> > }
> > }
> >
> > echo $_SESSION['TrolleyContents'];
> >
> > phpinfo();
> >
> > ?>
>
>
> Robert Cummings wrote:
>
> >John Taylor-Johnston wrote:
> >
> >
> >>Robert Cummings wrote:
> >>
> >>Why is it outdated semantics?
> >>
> >>
> >>
> >
> >Might i refer you to:
> >
> >http://ca.php.net/manual/en/language.variables.predefined.php
> >http://ca.php.net/manual/en/function.session-register.php
> >
> >$HTTP_POST_VARS has been considered deprecated for some time now.
> >session_register() is considered clumsy and dangerous since it is only
> >works with register_globals enabled which is itself considered poor
> >coding style in this enlightened era of PHP.
> >
> >Cheers,
> >Rob.
> >
> >
> So use
> $_POST["AddToTrolley"]
> instead of
> $HTTP_POST_VARS["AddToTrolley"]?

And $_SESSION instead of session_register and always access your session
vars through $_SESSION.

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация