oops... meant to send this to the list

----- Original Message -----
From: "Jason Bell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 17, 2002 10:27 AM
Subject: Re: [PHP] Class Function Issue


> Thanks for the tip. I tried that... I passed $HTTP_SESSION_VARS as a
> parameter, and it didn't work.  :/
>
> I also built another function inside the class to set session variables:
>
>         function SetSVAR($var,$value) {
>                 global $HTTP_SESSION_VARS;
>                 $HTTP_SESSION_VARS[$var] = $value;
>         }
>
> If I call $MyClass->SetSVAR($var,$Value); it works....
> but if I put $this->SetSVAR($var,$Value); inside a class function it
doesn't
> work....
>
> is it because these are in the same class? should they be seperated into 2
> seperate classes?
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, March 17, 2002 4:38 AM
> Subject: Re: [PHP] Class Function Issue
>
>
> At 16.03.2002  22:24, you wrote:
> >
> >Hi!  I'm building a class, and am trying to include an authorization
> >function.... the code works when used outside of the class, but when I
put
> >it inside the class, for some reason my session variables won't get
> >set.  Am I attempting the impossible, or am I missing something that I
> >need to make this work? Below is the code for the Auth function.
> >
> >
> >function Auth($username,$password) {
> >                 $query = "SELECT id,username,sl FROM KAOPA_users where
> > username='$username' AND password=PASSWORD('$password')";
> >                 $Auth = $this->Query($query);
> >                 if ($this->number_returned($Auth) == '1') {
> >                         $id = mysql_result($Auth,0,"id");
> >                         $uname = mysql_result($Auth,0,"username");
> >                         $sl = mysql_result($Auth,0,"sl");
> >                         global $HTTP_SESSION_VARS;
> >                         $HTTP_SESSION_VARS["id"] = $id;
> >                         $HTTP_SESSION_VARS["user"] = $uname;
> >                         $HTTP_SESSION_VARS["sl"] = $sl;
> >                 }
> >         }
> some vars make trouble, using inside a class or function inside a class.
> Even
> making them global doesn´t work. Try to set the vars via an explicit
> function,
> so that they´re available inside your class, or just make them parameters
> so your authorisation could look like
> $MyClass -> Auth($username,$password,$session_vars);
> HTH Oliver
>
>
> --
> 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

Reply via email to