Ejemplo n.º 1
0
*   (c) 2007-2015 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
********************************************************************************************************/
echo "+-------------------------------------------------------------------------------+\n";
echo "| Kajona Debug Subsystem                                                        |\n";
echo "|                                                                               |\n";
echo "| Delete all tables                                                             |\n";
echo "|                                                                               |\n";
echo "+-------------------------------------------------------------------------------+\n";
if (issetPost("dodelete")) {
    $strUsername = getPost("username");
    $strPassword = getPost("password");
    $objUsersource = new class_module_user_sourcefactory();
    $objUser = $objUsersource->getUserByUsername($strUsername);
    echo "Authenticating user...\n";
    if ($objUsersource->authenticateUser($strUsername, $strPassword)) {
        echo " ... authenticated.\n";
        $arrGroupIds = $objUser->getArrGroupIds();
        if (in_array(class_module_system_setting::getConfigValue("_admins_group_id_"), $arrGroupIds)) {
            echo "User is member of admin-group.\n";
            $arrTables = class_carrier::getInstance()->getObjDB()->getTables();
            foreach ($arrTables as $strOneTable) {
                $strQuery = "DROP TABLE " . $strOneTable;
                echo " executing " . $strQuery . "\n";
                class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array());
            }
        } else {
            echo "User is not a member of the admin-group!\n";
        }
    } else {
        echo "Authentication failed!\n";
Ejemplo n.º 2
0
 /**
  * Logs a user into the system if the credentials are correct
  * and the user is active
  *
  * @param string $strName
  * @param string $strPassword
  *
  * @return bool
  */
 public function login($strName, $strPassword)
 {
     $bitReturn = false;
     //How many users are out there with this username and being active?
     $objUsersources = new class_module_user_sourcefactory();
     try {
         if ($objUsersources->authenticateUser($strName, $strPassword)) {
             $objUser = $objUsersources->getUserByUsername($strName);
             $bitReturn = $this->internalLoginHelper($objUser);
         }
     } catch (class_authentication_exception $objEx) {
         $bitReturn = false;
     }
     if ($bitReturn === false) {
         class_logger::getInstance()->addLogRow("Unsuccessful login attempt by user " . $strName, class_logger::$levelInfo);
         class_module_user_log::generateLog(0, $strName);
     }
     return $bitReturn;
 }