Checking for Admin Permissions in custom pages

Discussion in 'Setting-up protection' started by miso, Dec 5, 2006.

  1. miso

    miso aMember Pro Customer

    Joined:
    Aug 22, 2006
    Messages:
    543
    Ok, how would I be able to check if the person accessing a custom made .php page is actually an admin (and logged in as well)?

    I have a few pages that are available to admins only, and I just wanna make sure the URLs to those don't get into wrong hands and are abused by people who shouldn't have access to them in the first place...

    I've noticed functions like

    check_lite();
    admin_check_permissions('XXX');

    but I have no idea what these do and how I can use them to my advantage... I am guessing that admin_check_permissions could be used (just check for a permission on something I have granted for that admin already)?
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Your file should start like that:

    PHP:
    include "./config.inc.php"// amember/config.inc.php
    $t new_smarty();
    include 
    "admin/login.inc.php"// to actually require login
    admin_check_permissions('browse_users'); // change it

Share This Page