Skip to content

Instantly share code, notes, and snippets.

@ano
Last active May 5, 2018 05:53
Show Gist options
  • Save ano/292af1915b38d1a15f4a72efad5a3688 to your computer and use it in GitHub Desktop.
Save ano/292af1915b38d1a15f4a72efad5a3688 to your computer and use it in GitHub Desktop.
Check if the Machform user is logged in AND that they have administrator permissions. If so, allow access to the PHPMaker application.
<?php
// Page Loading event
function Page_Loading() {
//echo "Page Loading";
}
/*
CUSTOM_CODE
-----------
Author: Ano Tisam
Date: 09/03/2016
Description: Administration Tool for Machform
*/
define("BASE_PATH", "../"); //Path to Machform root folder
require_once(BASE_PATH . "config.php");
require_once(BASE_PATH . "includes/helper-functions.php");
require_once(BASE_PATH . "hooks/lib/vendor/autoload.php");
require_once(BASE_PATH . "hooks/common/common.php");
if(empty($_SESSION['mf_logged_in']) || empty($_SESSION['mf_user_privileges']['priv_administer'])){
$_SESSION['MF_ERROR'] = "You dont have the right privileges to access developer console";
header("Location: " . BASE_PATH . "manage_forms.php");
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment