FAQ - Plugin install.php

Plugin install.php

4909


Let's explain how to build the install.php for a plugin.

Header:

// Include the config file...
if (!file_exists('../../config.php')) die('[install.php] config.php not found');
require_once '../../config.php';

// If not logged in...
if (!JAK_USERID) die('You cannot access this file directly.');

// If not an admin...
if (!$jakuser->jakAdminaccess($jakuser->getVar("usergroupid"))) die('You cannot access this file directly.');

// Set successfully to zero
$succesfully = 0;

This few lines needs to be in every install.php file for security purpose! The first line will include the config.php file from the root directory with all the necessary information like database connection, settings and user-group permission.

The next two functions will check that the user calls the file has permission to do so!

Please open any install.php file to check how I proceed with the rest, I commented it thru so it should be easy to understand!