Reply to Re: session_set_save_handler and error handling

Your name:

Reply:


Posted by Rik on 07/17/07 14:53

On Fri, 13 Jul 2007 22:09:08 +0200, Werner Elflein
<email@wernerelflein.de> wrote:

> Let open, close, read, write, destroy and gc be PHP functions to save
> the superglobal array $_SESSION in a database.
>
> I would like to use the following code:
>
> [1] session_set_save_handler(open,close,read,write,gc);
> [2] session_start();
> [3] if(!isset($_SESSION))
> [4] {
> /* error handling */
> exit;
> }
> /* session okay */
>
> But what will happen, if (e.g.) the database is down?

Whatever you want, you are the one to take action at that moment.

> Means: What kind of error handling can or must be implemented within the
> functions open, close, read, write, destroy and gc to get a stable
> script? Of course, line [3] is not enough ...

If you rely on a database, the error handling should be done in connecting
to the database. Wether to die(), to show the user an error page, or
continue on without a session is entirely up to you.
--
Rik Wasmus

[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

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