Example #1
0
 public function registerUser($fname, $lname, $email, $password, $conn)
 {
     include 'user-class.php';
     $password = $this->saltPassword($password);
     $user = new User();
     $user->setUser($fname, $lname, $email);
     $result = $user->addNewUser($conn, $password);
     if ($result["result"] != true) {
         $result["registerUser"] = "Sorry, account registration failed.\n      Please contact officer";
     } else {
         $result["registerUser"] = "Account registration success";
     }
     return $result;
 }
Example #2
0
    $phone = $_POST['phone'];
    $mail = $_POST['email'];
    if ($pass != $pass2) {
        $err .= __('Something went wrong with your Passwords, Please recheck') . "<br>";
        $fatal = TRUE;
    }
    if (empty($phone) || empty($pass) || empty($pass2) || empty($mail) || empty($fname) || empty($unmae)) {
        $err .= __('A field was left blank') . "<br>";
        $fatal = TRUE;
    }
    if (!checkEmail($mail)) {
        $err .= __('Problem With email Address') . "<br>";
        $fatal = TRUE;
    }
    if (!$fatal) {
        $result = $user->addNewUser($unmae, $pass, $mail, $fname, $phone);
        $err .= $result['text'];
        $user->populateUser($result['qid']);
    }
    echo '<div id="errors">' . $err . "</div>\t";
} elseif (isUser()) {
    echo '<div id="errors">';
    _e('You are already loged in');
    ?>
					<a href="<?php 
    echo HOME . $_SERVER['REQUEST_URI'];
    ?>
/logout" title="logout"><?php 
    _e('Log Out');
    ?>
</a></div>	
Example #3
0
 private function createNewUser()
 {
     // Get data
     $uname = $this->pageState['username'];
     $pw = $this->pageState['password'];
     $fname = $this->pageState['fullname'];
     $email = $this->pageState['email'];
     $home = $this->pageState['homefolder'];
     $dm = $this->pageState['foldermgr'];
     $em = $this->pageState['adveditor'];
     // If the user is an admin, make their home folder blank
     if ($home == '/') {
         $home = '';
     }
     // Place the given data into the user's information
     $userInfo['username'] = $uname;
     $userInfo['password'] = User::generatePassword($pw);
     $userInfo['friendlyName'] = $fname;
     $userInfo['email'] = $email;
     $userInfo['userPath'] = $home;
     $userInfo['directoryMode'] = strtolower($dm) == 'foldermgr' ? 'ADVANCED' : 'BASIC';
     $userInfo['editorMode'] = strtolower($em) == 'adveditor' ? 'ADVANCED' : 'BASIC';
     // Save the information to the user's config file
     if (User::saveUserInfo($uname, $userInfo)) {
         // Now save the username and fullname to the user file
         if (User::addNewUser($uname, $fname)) {
             // Redirect to userMgmt page
             header('Location:/manage/userMgmt/showMessage/msg/newUserAdded/user/' . $uname);
         } else {
             $errors[] = 'There was a problem adding the new user to the users file. Please check file permissions on the users file (make sure the file is writeable) and try again.';
             showForm($pageState, $errors);
         }
     } else {
         $errors[] = 'There was a problem creating a new user file for the user. Please check permissions on the config/users folder (make sure the folder is writeable) and try again.';
         $this->view->errors = $errors;
         $this->get();
     }
 }