Example #1
0
 function register()
 {
     if (isset($_POST) && !empty($_POST)) {
         $this->error = false;
         if ($_POST['password1'] != $_POST['password2'] || strlen($_POST['password1']) <= 1) {
             $this->error_type["pass"] = _("Password did not match");
             $this->error = true;
         }
         if (strlen($_POST['user']) <= 3) {
             $this->error_type["user"] = _("Username must be more than 2 character");
             $this->error = true;
         }
         if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
             $this->error_type["mail"] = _("eMail is not Valid");
             $this->error = true;
         }
         if ($this->error != true) {
             $user = new User();
             $return = $user->get_list(array("username" => $_POST['user']));
             if (count($return) > 0) {
                 $this->error_type["username"] = _("Username allready exist");
                 $this->error = true;
             }
         }
         if ($this->error != true) {
             $user = new User();
             $user->username = $_POST['user'];
             $user->password = md5($_POST['password1']);
             $user->email = $_POST['email'];
             $user->save();
             $_SESSION['user'] = $user->username;
             $_SESSION['user_id'] = $user->id;
             header("Location: " . Config::get('address') . "/user/video");
         }
     }
 }
Example #2
0
 /**
  * @brief display all the user to select the user with who we want to share
  * the connected user is not shown
  * @global type $g_user
  */
 function display_user()
 {
     global $g_user;
     // Get array of user
     $p_array = User::get_list(Dossier::id());
     $dossier = Dossier::id();
     include 'template/todo_list_list_user.php';
 }