Re: [GENERAL] passing variables in PHP3

Поиск
Список
Период
Сортировка
От Tatsuo Ishii
Тема Re: [GENERAL] passing variables in PHP3
Дата
Msg-id 20000228103350U.t-ishii@sra.co.jp
обсуждение исходный текст
Ответ на passing variables in PHP3  ("sheila bel" <sheilabel@hotmail.com>)
Список pgsql-general
> I've written an application for the web that asks users for their
> id and password, checks the database and if they are legit
> takes them to a page. Now I'm using the PHP_AUTH_USER variable
> to identify the user and I need that information from one
> file to another. How do I do that ? I tried storing it in a
> variable and sending it along an with html anchor but that is
> not a neat way of doing it since every time I need the value of
> that variable the user has to click on an image and another problem
> with that is the user id will show up in the url and I don't want
> that security risk.
> So my question is how do I store the value of PHP_AUTH_USER for
> a specific user and access it from many PHP3 files ?

First, you should not set PHP_AUTH_USER by yourself. It is
automazically set by PHP itself, if properly used(see sample code
below). Second, you do not need to embed the variable into the anchor.
Once the authentication is done for the directory where your login
page lives, the next page will automatically inherit PHP_AUTH_USER
variable.
--
Tatsuo Ishii

if (!$PHP_AUTH_USER) {
  Header("WWW-authenticate: basic realm=\"php authentication example\"");
  Header("HTTP/1.0 401 Unauthorized");
  print("User authentication is canceld");
  exit;
} else {
  // do whatever authentication method you like.
  // then set $auth to true if it succeeded.
  if ($auth == false) {
    Header("HTTP/1.0 401 Unauthorized");
    print("User authentication is failed");
    exit;
  }
}

В списке pgsql-general по дате отправления:

Предыдущее
От: "Gary MacMinn"
Дата:
Сообщение: Re: [GENERAL] passing variables in PHP3
Следующее
От: Charles Tassell
Дата:
Сообщение: Re: [GENERAL] passing variables in PHP3