pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris <csmith@squiz.net>
To: Christian Marschalek <cm@chello.at>
To: [PHP] PostgreSQL <pgsql-php@postgresql.org>
Subject: RE: Re: Re: Secure pages
Date: Wed, 14 Mar 2001 15:13:29 +1100
Message-ID: <4.3.2.7.2.20010314144332.00cd87e0@203.25.173.1> (raw)
In-Reply-To: <NEBBJIFEELNNHFCELNFJCEABCBAA.cm@chello.at>
References: <4.3.2.7.2.20010314092748.00b43b60@203.25.173.1>

Hey,

> > As someone else suggested, have a check on each page for a
> > session variable
> > (which of course is set when they login).
> >
> > <?
> >          if (!isset($sessionvariable) {
> >            header("Location:login.php");
> >            exit;
> >          }
> > ?>
>
>will do.. what excatly are session variables?

check out http://www.php.net/manual/en/ref.session.php for session info..

> > This can be in an include file, as a function (just remember to globalise
> > variables! I always forget :P), that way it will get checked on all your
> > protected pages :)
>
>globalise? there are no global variables in php, are they?;)

With functions, you can either pass variables or reference variables 
outside the function (for example, with a login function)... if they aren't 
passed to the function & need to be referenced, they have to be a global 
variable. Example below..

If you don't globalise the variable, then the form action will be nothing, 
because the function doesn't know what it is or where to get it's value 
from. Make sense?

function print_login_form () {
         global $PHP_SELF;
?>
<form method="post" action="<? echo $PHP_SELF ?>">
         Name
         <input type="text" value="">
         <br><br>
         Password
         <input type="password" value="">
         <br><br>
         <input type="submit" value="Log In">
</form>
<?
}

HTH

------------------------
Chris Smith
http://www.squiz.net




view thread (22+ messages)  latest in thread

Message-ID: <4.3.2.7.2.20010314144332.00cd87e0@203.25.173.1>
Permalink:  ../4.3.2.7.2.20010314144332.00cd87e0@203.25.173.1/
Also on:    postgresql.org/message-id/4.3.2.7.2.20010314144332.00cd87e0@203.25.173.1

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: csmith@squiz.net, cm@chello.at
  Subject: Re: Secure pages
  In-Reply-To: <4.3.2.7.2.20010314144332.00cd87e0@203.25.173.1>
  References: <4.3.2.7.2.20010314092748.00b43b60@203.25.173.1> <4.3.2.7.2.20010314144332.00cd87e0@203.25.173.1>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox