public function command() { // Por si entra sin permiso if (!hasRank('Moderador', $this->registry->userdata[User::RANK])) { echo 'No tienes permiso para hacer eso, listillo ¬_¬'; return; } $ws = new Websend('127.0.0.1'); if ($ws->connect()) { $command = isset($_POST['command']) ? $_POST['command'] : ''; $ws->doCommandAsConsole($command); echo 0; } $ws->disconnect(); }
<?php /*** include the controller class ***/ include __SITE_PATH . '/application/' . 'controller_base.class.php'; /*** include the registry class ***/ include __SITE_PATH . '/application/' . 'registry.class.php'; /*** include the router class ***/ include __SITE_PATH . '/application/' . 'router.class.php'; /*** include the template class ***/ include __SITE_PATH . '/application/' . 'template.class.php'; /*** auto load model classes ***/ function __autoload($class_name) { $filename = strtolower($class_name) . '.class.php'; $file = __SITE_PATH . '/model/' . $filename; if (file_exists($file) == false) { return false; } include $file; } /*** a new registry object ***/ $registry = new registry(); /*** create the database registry object ***/ $registry->db = db::getInstance(); /*** start php session and variables with user's info ***/ session_start(); $registry->userdata = !($id = isSessionActive()) ? false : User::getUserValues($id); $registry->hasstaffperm = !$registry->userdata ? false : hasRank('Moderador', $registry->userdata[User::RANK]);