Re: [PHP-DB] Re: losing my session variables

2002-10-29 Thread Peter Beckman
prepend.php gets called before running any page on a site.  Put the
"session_start()" in the prepend.php and you won't have to worry where you
put it.

Learn more about it on the php web site (don't have the url handy).

Peter

On Tue, 29 Oct 2002, Seabird wrote:

> turns out, I already have a session_start(). I have some seperate files and
> use them as includes. The thing is... my login form is located on my
> "index.php" and if I do a login, only this file will recognize my session
> variables.
>
> I load pages external into a layer, but none of them get the session
> variables. I'll upload some files so you can see. I'll post this.
>
> Thanx already,
> Jacco
> --
> http://seabird.jmtech.ca
>
> Attitude is Everything!
> But Remember, Attitudes are Contagious!
> Is Yours worth Catching
> "Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> wrote in message
> news:20021030002059.9083.qmail@;pb1.pair.com...
> > You only need to add session_start() in your script before storing your
> data
> > into the $_SESSION array.
> > Without session_start(), no session is started by php...
> >
> > Regards,
> > P.E. Baroiller
> >
> > "Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
> > [EMAIL PROTECTED]
> > > Hi everyone,
> > >
> > > I use a login-script, but for some reason I keep losing my $_SESSION
> > > variables. Can Anyone tell me why?
> > >
> > > Here's my login script:
> > >
> > >  > > if(isset($_POST['submit'])) { // if form has been submitted
> > >  /* check they filled in what they were supposed to and authenticate */
> > >  if(!$_POST['uname'] | !$_POST['passwd']) {
> > >   print '
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >   please fill in the required
> > > fields.
> > >   
> > > ';
> > >  }
> > >  // authenticate.
> > >  if(!get_magic_quotes_gpc()) {
> > >   $_POST['uname'] = addslashes($_POST['uname']);
> > >  }
> > >  $check = $db_object->query("SELECT username, password FROM users WHERE
> > > username = '".$_POST['uname']."'");
> > >  if(DB::isError($check)) {
> > >   print '
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >   username doesn\'t exist.  > > class="header"
> > > href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
> > up
> > > here
> > >   
> > > ';
> > >  }
> > >  $info = $check->fetchRow();
> > >  // check passwords match
> > >  $_POST['passwd'] = stripslashes($_POST['passwd']);
> > >  $info['password'] = stripslashes($info['password']);
> > >  $_POST['passwd'] = md5($_POST['passwd']);
> > >  if($_POST['passwd'] != $info['password']) {
> > >   print '
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >   wrong password, try again
> > >   
> > > ';
> > >  }
> > >
> > >  // if we get here username and password are correct, register session
> > > variables and set
> > >  // last login time.
> > >  $date = date('m d, Y');
> > >  $update_login = $db_object->query("UPDATE users SET last_login =
> '$date'
> > > WHERE username = '".$_POST['uname']."'");
> > >  $_POST['uname'] = stripslashes($_POST['uname']);
> > >  $_SESSION['username'] = $_POST['uname'];
> > >  $_SESSION['password'] = $_POST['passwd'];
> > >  $db_object->disconnect();
> > > ?>
> > > Welcome  > >
> >
> href="javascript:loadPage('mainlayer',null,'users/edit.php?user= > > ['username']?>')"> > > color="white"> > > href="login/logout.php">Logout
> > > 
> > >  > > }
> > > else { // if form hasn't been submitted
> > > ?>
> > > 
> > > 
> > >> > maxlength="8">
> > >> > name="passwd">
> > >   
> > >   
> > >> > href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> > > here 
> > >   
> > >  > > }
> > > ?>
> > >
> > > --
> > > http://seabird.jmtech.ca
> > >
> > > Attitude is Everything!
> > > But Remember, Attitudes are Contagious!
> > > Is Yours worth Catching
> > >
> > >
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: losing my session variables

2002-10-29 Thread Seabird
turns out, I already have a session_start(). I have some seperate files and
use them as includes. The thing is... my login form is located on my
"index.php" and if I do a login, only this file will recognize my session
variables.

I load pages external into a layer, but none of them get the session
variables. I'll upload some files so you can see. I'll post this.

Thanx already,
Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
"Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> wrote in message
news:20021030002059.9083.qmail@;pb1.pair.com...
> You only need to add session_start() in your script before storing your
data
> into the $_SESSION array.
> Without session_start(), no session is started by php...
>
> Regards,
> P.E. Baroiller
>
> "Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
> [EMAIL PROTECTED]
> > Hi everyone,
> >
> > I use a login-script, but for some reason I keep losing my $_SESSION
> > variables. Can Anyone tell me why?
> >
> > Here's my login script:
> >
> >  > if(isset($_POST['submit'])) { // if form has been submitted
> >  /* check they filled in what they were supposed to and authenticate */
> >  if(!$_POST['uname'] | !$_POST['passwd']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   please fill in the required
> > fields.
> >   
> > ';
> >  }
> >  // authenticate.
> >  if(!get_magic_quotes_gpc()) {
> >   $_POST['uname'] = addslashes($_POST['uname']);
> >  }
> >  $check = $db_object->query("SELECT username, password FROM users WHERE
> > username = '".$_POST['uname']."'");
> >  if(DB::isError($check)) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   username doesn\'t exist.  > class="header"
> > href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
> up
> > here
> >   
> > ';
> >  }
> >  $info = $check->fetchRow();
> >  // check passwords match
> >  $_POST['passwd'] = stripslashes($_POST['passwd']);
> >  $info['password'] = stripslashes($info['password']);
> >  $_POST['passwd'] = md5($_POST['passwd']);
> >  if($_POST['passwd'] != $info['password']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   wrong password, try again
> >   
> > ';
> >  }
> >
> >  // if we get here username and password are correct, register session
> > variables and set
> >  // last login time.
> >  $date = date('m d, Y');
> >  $update_login = $db_object->query("UPDATE users SET last_login =
'$date'
> > WHERE username = '".$_POST['uname']."'");
> >  $_POST['uname'] = stripslashes($_POST['uname']);
> >  $_SESSION['username'] = $_POST['uname'];
> >  $_SESSION['password'] = $_POST['passwd'];
> >  $db_object->disconnect();
> > ?>
> > Welcome  >
>
href="javascript:loadPage('mainlayer',null,'users/edit.php?user= > ['username']?>')"> > color="white"> > href="login/logout.php">Logout
> > 
> >  > }
> > else { // if form hasn't been submitted
> > ?>
> > 
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >> href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> > here 
> >   
> >  > }
> > ?>
> >
> > --
> > http://seabird.jmtech.ca
> >
> > Attitude is Everything!
> > But Remember, Attitudes are Contagious!
> > Is Yours worth Catching
> >
> >
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: losing my session variables

2002-10-29 Thread Seabird
where do I place a session start in a script? before the form? after?
inside?
Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
"Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> wrote in message
news:20021030002059.9083.qmail@;pb1.pair.com...
> You only need to add session_start() in your script before storing your
data
> into the $_SESSION array.
> Without session_start(), no session is started by php...
>
> Regards,
> P.E. Baroiller
>
> "Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
> [EMAIL PROTECTED]
> > Hi everyone,
> >
> > I use a login-script, but for some reason I keep losing my $_SESSION
> > variables. Can Anyone tell me why?
> >
> > Here's my login script:
> >
> >  > if(isset($_POST['submit'])) { // if form has been submitted
> >  /* check they filled in what they were supposed to and authenticate */
> >  if(!$_POST['uname'] | !$_POST['passwd']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   please fill in the required
> > fields.
> >   
> > ';
> >  }
> >  // authenticate.
> >  if(!get_magic_quotes_gpc()) {
> >   $_POST['uname'] = addslashes($_POST['uname']);
> >  }
> >  $check = $db_object->query("SELECT username, password FROM users WHERE
> > username = '".$_POST['uname']."'");
> >  if(DB::isError($check)) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   username doesn\'t exist.  > class="header"
> > href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
> up
> > here
> >   
> > ';
> >  }
> >  $info = $check->fetchRow();
> >  // check passwords match
> >  $_POST['passwd'] = stripslashes($_POST['passwd']);
> >  $info['password'] = stripslashes($info['password']);
> >  $_POST['passwd'] = md5($_POST['passwd']);
> >  if($_POST['passwd'] != $info['password']) {
> >   print '
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >   wrong password, try again
> >   
> > ';
> >  }
> >
> >  // if we get here username and password are correct, register session
> > variables and set
> >  // last login time.
> >  $date = date('m d, Y');
> >  $update_login = $db_object->query("UPDATE users SET last_login =
'$date'
> > WHERE username = '".$_POST['uname']."'");
> >  $_POST['uname'] = stripslashes($_POST['uname']);
> >  $_SESSION['username'] = $_POST['uname'];
> >  $_SESSION['password'] = $_POST['passwd'];
> >  $db_object->disconnect();
> > ?>
> > Welcome  >
>
href="javascript:loadPage('mainlayer',null,'users/edit.php?user= > ['username']?>')"> > color="white"> > href="login/logout.php">Logout
> > 
> >  > }
> > else { // if form hasn't been submitted
> > ?>
> > 
> > 
> >> maxlength="8">
> >> name="passwd">
> >   
> >   
> >> href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> > here 
> >   
> >  > }
> > ?>
> >
> > --
> > http://seabird.jmtech.ca
> >
> > Attitude is Everything!
> > But Remember, Attitudes are Contagious!
> > Is Yours worth Catching
> >
> >
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: losing my session variables

2002-10-29 Thread BAROILLER Pierre-Emmanuel
You only need to add session_start() in your script before storing your data
into the $_SESSION array.
Without session_start(), no session is started by php...

Regards,
P.E. Baroiller

"Seabird" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi everyone,
>
> I use a login-script, but for some reason I keep losing my $_SESSION
> variables. Can Anyone tell me why?
>
> Here's my login script:
>
>  if(isset($_POST['submit'])) { // if form has been submitted
>  /* check they filled in what they were supposed to and authenticate */
>  if(!$_POST['uname'] | !$_POST['passwd']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   please fill in the required
> fields.
>   
> ';
>  }
>  // authenticate.
>  if(!get_magic_quotes_gpc()) {
>   $_POST['uname'] = addslashes($_POST['uname']);
>  }
>  $check = $db_object->query("SELECT username, password FROM users WHERE
> username = '".$_POST['uname']."'");
>  if(DB::isError($check)) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   username doesn\'t exist.  class="header"
> href="javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')">sign
up
> here
>   
> ';
>  }
>  $info = $check->fetchRow();
>  // check passwords match
>  $_POST['passwd'] = stripslashes($_POST['passwd']);
>  $info['password'] = stripslashes($info['password']);
>  $_POST['passwd'] = md5($_POST['passwd']);
>  if($_POST['passwd'] != $info['password']) {
>   print '
> 
>maxlength="8">
>name="passwd">
>   
>   
>   wrong password, try again
>   
> ';
>  }
>
>  // if we get here username and password are correct, register session
> variables and set
>  // last login time.
>  $date = date('m d, Y');
>  $update_login = $db_object->query("UPDATE users SET last_login = '$date'
> WHERE username = '".$_POST['uname']."'");
>  $_POST['uname'] = stripslashes($_POST['uname']);
>  $_SESSION['username'] = $_POST['uname'];
>  $_SESSION['password'] = $_POST['passwd'];
>  $db_object->disconnect();
> ?>
> Welcome 
href="javascript:loadPage('mainlayer',null,'users/edit.php?user= ['username']?>')"> color="white"> href="login/logout.php">Logout
> 
>  }
> else { // if form hasn't been submitted
> ?>
> 
> 
>maxlength="8">
>name="passwd">
>   
>   
>href="javascript:loadPage('mainlayer',null,'login/signup.php')">sign up
> here 
>   
>  }
> ?>
>
> --
> http://seabird.jmtech.ca
>
> Attitude is Everything!
> But Remember, Attitudes are Contagious!
> Is Yours worth Catching
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php