This topic is locked

passing a field value to an event...

6/28/2006 12:48:44 AM
PHPRunner General questions
A
arrowhot author

I added an event to global events - login - after successful login, to attempt to record a usernumber, IP date, and event type. The event code looks liks this:
function AfterSuccessfulLogin()

{

//** Insert a record into another table ****

global $conn;

$ip = $_SERVER["REMOTE_ADDR"];

$name = @$_SESSION["usernum"];

$strSQLInsert = "insert into events (ev_ip, ev_user, ev_date, ev_type) values ('$ip','$name', NOW(),'login')";

db_exec($strSQLInsert,$conn);
The part that isn't working is related to "usernum". This is the field name in my user table. How do I pass that value back to this event function so I can write it into the record? I'm missing something. Everything else shows up 'events' table after a login, except the usernum. It's always zero (should be a number).
Any ideas as to what I'm missing? (I'm sure it's something simple..!)
Thx.

Alexey admin 6/28/2006

Hi,
use $_POST["username"] variable to get the Username entered by the user.