<?php
require_once "routeros_api.class.php";

define("MIKROTIK_IP","192.168.88.1");
define("MIKROTIK_USER","admin");
define("MIKROTIK_PASS","password");

function mikrotik_connect(){
    $API=new RouterosAPI();
    if($API->connect(MIKROTIK_IP,MIKROTIK_USER,MIKROTIK_PASS)) return $API;
    return false;
}
function enableUser($username){
    if(!$username) return;
    if($API=mikrotik_connect()){
        $API->comm("/ip/hotspot/user/enable",["numbers"=>$username]);
        $API->disconnect();
    }
}
function disableUser($username){
    if(!$username) return;
    if($API=mikrotik_connect()){
        $API->comm("/ip/hotspot/user/disable",["numbers"=>$username]);
        $API->disconnect();
    }
}
function setProfile($username,$profile){
    if(!$username||!$profile) return;
    if($API=mikrotik_connect()){
        $API->comm("/ip/hotspot/user/set",["numbers"=>$username,"profile"=>$profile]);
        $API->disconnect();
    }
}
