This topic is locked

The Current User

12/15/2008 4:38:49 PM
PHPRunner General questions
N
nbrennan author

In PHPRunner 5.0, I want to stamp a field with the user name of the person that logged in. Is there a value somewhere that is stored, showing who is currently logged in?

S
steveh 12/16/2008

What I do is save all the relevant fields in session variables in the "After Successful Login" event.

J
Jane 12/16/2008

Hi,
select and save required values in the session variables in the After Successful Login event on the Events tab.

Here is a sample:

global $conn;

$rs = db_query("select field1, field2 from TableName where Username='".$_SESSION["UserID"]."'",$conn);

$data = db_fetch_array($rs);
$_SESSION["field1"] = $data["field1"];

$_SESSION["field2"] = $data["field2"];

N
nbrennan author 12/16/2008

Hi,

select and save required values in the session variables in the After Successful Login event on the Events tab.

Here is a sample:


I think I described what I'm looking for improperly. I have PHPRunner generating a login page, using one of my tables to pull the authorized users from. AfterSuccessfulLogin, $username is available, but I was wondering if its possible to reference $username from elsewhere, like an "AfterRecordUpdated" event.

S
steveh 12/16/2008

Store it in a session variable and then you can reference it from anywhere, check on www.php.net for session variables.

N
nbrennan author 12/16/2008

Store it in a session variable and then you can reference it from anywhere, check on www.php.net for session variables.



Thanks! I actually figured that one out, for some reason, I was not aware that you could manually set session variables (dumb on my part). Thanks for the help!