phpp1

    0

    0

    ALJOHARAH FAWAZ 

    else { false; } ?>

    The first line of this code initializes a namespace for use in the code. The next line imports the AuthManager class. The if statement tests whether the POST parameter "fnName" is equal to "login". If it is, the code tries to call the AuthManager::Login() method. If the method fails, the code prints "false" and terminates the script. If the if statement matches "register", the code tries to call the AuthManager::AddUser() method. If the method fails, the code prints "false". If the if statement matches "any other", the code prints false.

    <?php
    
    namespace ES\Core;
    
    use Exception;
    
    include_once "AuthManager.php";
    
        if ($_POST['fnName'] === 'login') {
          try {
              echo AuthManager::Login($_POST['userName'], $_POST['password']);
          } catch (Exception $ex) {
              echo "false";
          }
        } else if ($_POST['fnName'] === 'register') {
          try {
              echo AuthManager::AddUser($_POST['userName'], $_POST['password']);
          } catch (Exception $ex) {
              echo "false";
          }
        }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.