This topic is locked
[SOLVED]

 Add global field in login.

4/9/2016 11:01:54
PHPRunner General questions
crodrigof author

Hello, is there a way to put a field in the login and use it as a filter on all tables?
Best regards.

Sergey Kornilov admin 4/11/2016

Yes, this can be done.

  1. Modify login page in Visual Editor adding a new text field. The best option is to do that in HTML mode.

<INPUT name="filter" type="text">


2. In AfterSuccessfulLogin event save the entered value in session variable for later use.

$_SESSION["filter"] = addSlashes($_POST["filter"]);


addSlahes() function helps us prevent SQL injection.
3. Now in event like After Table Initialized event you can add this filter to SQL query:

$query->addWhere("somefield='".$_SESSION["filter"]."'");