RE: [PHP] Apache, html, php and global variables
| From: | John Holmes | Date: | Sat, 01 Jun 2002 14:09:55 +0000 |
| Subject: | RE: [PHP] Apache, html, php and global variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100220@lists.php.net to get a copy of this message | ||
Sessions use cookies, which use headers, which have to be sent before
any output. <html> is output. So, put session_start() before that.
<?
Session_start();
...
?>
<html>
<body>
...
Where are you putting dbauser and dbapassword into the session?
Your sessions still aren't going to work because the session.save_path
isn't set correctly in your PHP.ini. Set it to a directory on your
computer that the web server has access to write to.
---John Holmes...
> -----Original Message-----
> From: Peter Goggin [mailto:pgoggin@smartchat.net.au]
> Sent: Saturday, June 01, 2002 9:54 AM
> To: holmes072000@charter.net; php-general@lists.php.net
> Subject: Re: [PHP] Apache, html, php and global variables
>
> I am not clear what you mean by this. I have set session_start() on in
the
> php script that logs onto the database initially. i then call a test
php
> script from a button on the menu frame. This is the output it gives:
>
> Test php variables
>
> Warning: Cannot send session cookie - headers already sent by (output
> started at c:\usr\www\my-domain\maintenance.php:4) in
> c:\usr\www\my-domain\maintenance.php on line 5
>
> Warning: Cannot send session cache limiter - headers already sent
(output
> started at c:\usr\www\my-domain\maintenance.php:4) in
> c:\usr\www\my-domain\maintenance.php on line 5
>
> Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
failed:
> No
> such file or directory (2) in c:\usr\www\my-domain\maintenance.php on
line
> 5
> Test of global variables
> DBA USER:
> DBA Password;
> Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
failed:
> No
> such file or directory (2) in Unknown on line 0
>
> Warning: Failed to write session data (files). Please verify that the
> current setting of session.save_path is correct (/tmp) in Unknown on
line
> 0
>
>
> The script is:
> <HTML>
> <BODY>
> Test php variables<BR>
> <?php
> session_start();
> printf ("Test of global variables<BR>");
> printf ("DBA USER: ",$_SESSION_VARS["dbauser"],"<BR>");
> printf ("<BR>");
> printf ("DBA Password;
> ",$_SESSION_VARS["dbapassword"],"<BR>");
> ?>
> </BODY>
> </HTML>
>
> Is there a problem with how I am using sessiot_start, or is there a
php
> config problem?
>
> Regards
>
> Peter Goggin
>
> ----- Original Message -----
> From: "John Holmes" <holmes072000@charter.net>
> To: "'Peter Goggin'" <pgoggin@smartchat.net.au>; <php-
> general@lists.php.net>
> Sent: Saturday, June 01, 2002 2:04 PM
> Subject: RE: [PHP] Apache, html, php and global variables
>
>
> > You still have to connect to a database every time a script is run,
> > whether it's loaded in a frame or run by itself. If you start a
session
> > and save the username and password in it, then you can use that
login
> > and password on every other page that you call session_start() on.
> >
> > ---John Holmes...
> >
> > > -----Original Message-----
> > > From: Peter Goggin [mailto:pgoggin@smartchat.net.au]
> > > Sent: Friday, May 31, 2002 11:12 PM
> > > To: php-general@lists.php.net
> > > Subject: Re: [PHP] Apache, html, php and global variables
> > >
> > > I am not certain how this helps me, since it appears the data is
only
> > > carried to pages called directly from where it is set. The page
where
> > the
> > > user logs onto the database does not link to other pages. This is
done
> > > from
> > > the top frame of the form. The top frame of the inital page
contains
> > the
> > > menu, one option of which is to log onto the data base to start a
> > session.
> > > The user will then select another page from the top form.
> > >
> > > This new page is displayed in the bottom frame of the intial page,
and
> > > there
> > > may be futher links within this page on the bottom fram.Generally
> > however
> > > main navigation is from the top frame which remains in place
through
> > out.
> > > What I wabt to do is to have the login information available at
all
> > times
> > > once the user is logged in, nomattar how the current page is
called.
> > >
> > > Is this possible?
> > >
> > > If so how is this done?
> > >
> > >
> > > ----- Original Message -----
> > > From: "Stuart Dallas" <stuart@sharedserver.net>
> > > To: <php-general@lists.php.net>
> > > Sent: Saturday, June 01, 2002 11:56 AM
> > > Subject: Re: [PHP] Apache, html, php and global variables
> > >
> > >
> > > > On Saturday, June 1, 2002 at 2:42:40 AM, you wrote:
> > > > > Is there any way of caryying the login information from one
web
> > page
> > > to
> > > the
> > > > > next in global variables so that the username and password
entered
> > in
> > > the
> > > > > login screen is available to all other web pages in the site
or do
> > I
> > > have to
> > > > > ask the user to re-enter this information at every screen?
> > > >
> > > > Sessions: http://www.php.net/session
> > > >
> > > > --
> > > > Stuart
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit:
> > > > http://www.php.net/unsub.php
> > > >
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >