Example #1
0
        $action = $params['action'];
    }
}
// var_dump($params);
$result = ErrorFactory::getError(ErrorFactory::ERR_MISSING_PARAMETERS);
switch ($action) {
    case "login":
        if (validate_input_param($params, array('name', 'type', 'password'))) {
            $user = new User();
            $user->setName($params['name']);
            // 			$user->setId($params['id']);
            $user->setPassword(md5($params['password']));
            $user->setType($params['type']);
            $ctr = new LoginController();
            try {
                $result = $ctr->checkWebAdminLogin($user);
            } catch (SSSException $e) {
                $result = ErrorFactory::getError($e->getCode());
            }
        }
        break;
    case "addUser":
        if (validate_input_param($params, array('name', 'type', 'password'))) {
            $user = new User();
            $user->setName($params['name']);
            $user->setPassword(md5($params['password']));
            $user->setType($params['type']);
            $ctr = new WebController();
            try {
                $result = $ctr->addUser($user);
            } catch (SSSException $e) {