This topic is locked

Creating Session Variables

11/26/2007 7:24:06 AM
PHPRunner General questions
K
KevinMillican author

Is it possible to use the successful login event to read the user table and create a session variable based on another field ?
I want to associate each user with a 'Company' from the users table and then filter the records they can see based on this.

K
KevinMillican author 11/26/2007

Is it possible to use the successful login event to read the user table and create a session variable based on another field ?

I want to associate each user with a 'Company' from the users table and then filter the records they can see based on this.


Er - OK, I discovered it by trial and error.
I added this to the AfterSuccessfulLogin event:

$_SESSION["Company"]=@$data["Company"];

  1. For the Add Page:-

    I added this to the lookup WHERE clause:

    " Company like '".$_SESSION["Company"]."%'"
    and this to the default value for the field:

    $_SESSION["Company"]
  2. For the List Page:-
    I added this to the BeforeQueryList event:

    $strWhereClause=whereAdd($strWhereClause,"Company LIKE '".$_SESSION["Company"]."%'");