Beispiel #1
0
function addUser($sessionkey, $appcode, $Userdata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_User = new User();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "USERID":
                    $obj_User->userId = $child;
                    break;
                case "USERNAME":
                    $obj_User->userName = $child;
                    break;
                case "PASSWORD":
                    $obj_User->password = $child;
                    break;
                case "PERSONID":
                    $obj_User->personId = $child;
                    break;
                case "USERTYPE":
                    $obj_User->userType = $child;
                    break;
                case "USEROPTCODE":
                    $obj_User->userOptCode = $child;
                    break;
                case "USERMETADATA":
                    $obj_User->userMetadata = $child;
                    break;
                case "USERSTATUS":
                    $obj_User->userStatus = $child;
                    break;
            }
        }
        $obj_retResult_User = DAL_manageUser::addUser($obj_User);
        if ($obj_retResult_User->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getUserXml($obj_retResult_User->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
Beispiel #2
0
 public static function addUser2($userId, $userName, $password, $personId, $userType)
 {
     $obj_retResult = new returnResult();
     $obj_newUser = new User();
     $obj_newuser->setUser($userId, $userName, $password, $personId, $userType);
     // $isExist = BL_manageUser::isExist($obj_newUser->id);
     if (!$isExist) {
         $obj_retResult_User = DAL_manageUser::addUser($obj_newUser);
         if ($obj_retResult_User->type == 1) {
             $obj_retResult->type = 1;
             $obj_retResult->msg = "Success";
             $obj_retResult->data = $obj_retResult_User->data;
         } else {
             $obj_retResult->type = 0;
             $obj_retResult->msg = "Failed";
         }
     } else {
         $obj_retResult->type = 0;
         $obj_retResult->msg = "Sorry! User already exist";
     }
     return $obj_retResult;
 }