コード例 #1
0
ファイル: remove.php プロジェクト: michalkoczwara/WebGoatPHP
 function Start()
 {
     $App = $this->App;
     $View = $this->View;
     # Put your logic here
     $Users = new SystemUsersModel($App);
     $View->Count = $Users->UserCount();
     if (isset($_POST['sel'])) {
         foreach ($_POST['sel'] as $v) {
             $App->Session->RemoveUser($App->Session->Username($v));
         }
         echo "A total number of " . count($_POST['sel']) . " users where removed.<hr/><a href='?'>Back</a>";
     } else {
         $limit = 30;
         $offset = 0;
         if (isset($_GET['limit'])) {
             $limit = $_GET['limit'];
         }
         if (isset($_GET['offset'])) {
             $offset = $_GET['offset'];
         }
         $View->Users = $Users->AllUsers($offset, $limit);
         $View->Offset = $offset;
         $View->Limit = $limit;
     }
     $this->Present();
 }
コード例 #2
0
ファイル: edit.php プロジェクト: michalkoczwara/WebGoatPHP
 function Start()
 {
     $App = $this->App;
     $View = $this->View;
     # Put your logic here
     $Users = new SystemUsersModel($App);
     $View->Count = $Users->UserCount();
     if (isset($_POST['uid'])) {
         $UserID = $_POST['uid'];
         $Username = $_POST['Username'];
         $Password = $_POST['Password'];
         if ($Password == "") {
             $Password = null;
         }
         $Result = $App->Session->EditUser($App->Session->Username($UserID), $Username, $Password);
         if ($Result) {
             echo "Edit successful.";
         } elseif ($Result == false) {
             echo "The new username you specified already exists!";
         } elseif ($Result == null) {
             echo "The old username you specified does not exist!";
         }
         echo "<hr/><a href='?' >Back</a>";
     } elseif (isset($_GET['uid'])) {
         $View->User = $Users->User($_GET['uid']);
         $View->User = $View->User[0];
     } else {
         $limit = 30;
         $offset = 0;
         if (isset($_GET['limit'])) {
             $limit = $_GET['limit'];
         }
         if (isset($_GET['offset'])) {
             $offset = $_GET['offset'];
         }
         $View->Users = $Users->AllUsers($offset, $limit);
         $View->Offset = $offset;
         $View->Limit = $limit;
     }
     $this->Present();
 }
コード例 #3
0
ファイル: assign.php プロジェクト: michalkoczwara/WebGoatPHP
 function Start()
 {
     $View = $this->View;
     if (isset($_POST['rid'])) {
         $Replace = $_POST['Replace'];
         if ($_POST['rid']) {
             foreach ($_POST['rid'] as $R) {
                 if ($_POST['uid']) {
                     foreach ($_POST['uid'] as $U) {
                         $this->App->RBAC->User_AssignRole($R, $U, $Replace);
                     }
                 }
             }
         }
         $View->Result = count($_POST['rid']) * count($_POST['uid']);
     }
     $Userman = new SystemUsersModel($this->App);
     $View->Users = $Userman->AllUsers();
     $View->Roles = $this->App->RBAC->Role_All();
     $this->Present();
 }