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

Reply via email to