Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Global events

Events.After application initialized

Scroll Prev Next More

Description

The AfterAppInit event is executed after the application is initialized.

 

Use this event to override any global PHPRunner variables. See the description area in the Event editor for the list of available global variables.

 

Note: It is not recommended to use this event to display anything on the web page. Doing so may break your application.

Syntax

AfterAppInit()

Applies to pages

All pages.

Example

Let's say you need to troubleshoot your application by displaying an executed SQL query at the top of the page.

 

One way to do so is to proceed to the include/appsettings.php file and set the $dDebug variable to true. Though it might be tedious to change this variable back and forth.

 

By using the AfterAppInit event, you can display the debug info by adding debug=true to the URL.

AfterAppInit code:

if ($_REQUEST["debug"]=="true")
$dDebug=true;

 

Sample URL: categories_list.php?debug=true.

 

Note: the Database connection is not yet open in this event. If you need to perform any database operations, open the database connection manually.

$conn = mysqli_connect("localhost:3306","root","root","dbname");
mysqli_query($conn,"INSERT INTO Log (LastAccesTime) Values(now())");

 

Note: in this event, you can also apply the Database API methods to interact with the database.  

Recommended predefined actions and sample events:

Send a simple email

Display a message on the Web page

Redirect to another page

Restrict access to PHPRunner application by IP address

See also:

Query Designer tab

SQLQuery screen

About SQLQuery API

Troubleshooting tips

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software