function checkUserOnDatabase($usuario, $usu_nombre, $usu_clave, $db, $areMany)
{
    if ($usuario->usu_nombre === $usu_nombre || $usuario->usu_correo === $usu_nombre) {
        if ($usuario->usu_clave === $usu_clave) {
            // $recordarme = !empty($_POST['recordarme']) ? test_input($_POST['recordarme']) : NULL;
            // $recordarme = $recordarme === 'true' ? true : NULL;
            echo result_construct('success', 'login', $usuario->pkusu_id);
            setSessionVariables($usuario->pkusu_id, $db);
            die;
        }
        header('HTTP/1.1 409 Conflict');
        echo result_construct('error', 'usu_clave', 'La contraseña no coincide, por favor verifique.');
        die;
    }
    if (!$areMany) {
        header('HTTP/1.1 409 Conflict');
        echo result_construct('error', 'usu_nombre', 'Lo sentimos pero no se encuentra en el sistema, por favor registrarse primero.');
        die;
    }
}
示例#2
0
             $folder = $userarray[2];
             if ($userarray[3] != "") {
                 $show_delete = $userarray[3];
             }
             if ($userarray[4] != "") {
                 $enable_folder_browsing = $enable_folder_creation = $userarray[4];
                 $enable_folder_deletion = $enable_folder_rename = $userarray[4];
             }
             break;
         } else {
             $login = "******";
         }
     }
 }
 // this setting are needed in the other php files too!
 setSessionVariables();
 // sending and checking the registration infos - check is done in the flash therefore
 // we have to send all the registration infos to the flash too!
 $license_file = $install_path . "twg.lic.php";
 if (file_exists($license_file)) {
     include $license_file;
     // we encrypt the license data since 1.7 to enhance security!
     $d = tfu_enc($d, $rn);
     $l = tfu_enc($l, $rn);
     $s = tfu_enc($s, $rn);
     $m = tfu_enc($m, $rn);
     $reg_infos = "&d=" . $d . "&s=" . $s . "&m=" . $m . "&l=" . $l;
 } else {
     $reg_infos = "";
     // means freeware version!
 }
示例#3
0
             $location = empty($message) ? LINKEDITLIST : LINKEDITLIST . '?message=' . $message;
         }
         header('Location:' . $location);
     }
 } elseif (!empty($_COOKIE[UNIQUECOOKIE])) {
     //Check the browser cookie against the database.
     $debug->add('3');
     $uniqueIdCheckStmt = $Dbc->prepare("SELECT\n\tapprovedDevices.userId AS 'userId',\n\tusers.userId AS 'userId',\n\tusers.primaryEmail AS 'primaryEmail',\n\tusers.secondaryEmail AS 'secondaryEmail',\n\tusers.firstName AS 'firstName',\n\tusers.lastName AS 'lastName',\n\tuserSiteSettings.timeZone AS 'timeZone',\n\tuserSiteSettings.listId AS 'listId',\n\tuserSiteSettings.viewListOnLogin AS 'viewListOnLogin',\n\tuserSiteSettings.siteRoleId AS 'siteRoleId',\n\tdateFormat.dateFormat AS 'dateFormat'\nFROM\n\tusers\nJOIN\n\tuserSiteSettings ON userSiteSettings.userId = users.userId\nJOIN\n\tapprovedDevices ON approvedDevices.userId = users.userId AND\n\tapprovedDevices.uniqueId = ?\nJOIN\n\tdateFormat ON dateFormat.dateFormatId = userSiteSettings.dateFormatId");
     $uniqueIdCheckParams = array($_COOKIE[UNIQUECOOKIE]);
     $uniqueIdCheckStmt->execute($uniqueIdCheckParams);
     $row = $uniqueIdCheckStmt->fetch(PDO::FETCH_ASSOC);
     if (!empty($row)) {
         $row['uniqueId'] = $_COOKIE[UNIQUECOOKIE];
         $_SESSION['auth'] = true;
     }
     setSessionVariables($row);
 }
 if (isset($_SESSION['siteRoleId']) && empty($_SESSION['siteRoleId'])) {
     //The user has been implicitley denied access to the site.
     destroySession();
     header('Location: ' . LINKLOGIN . '/?logout=1');
 } elseif ($_SESSION['auth']) {
     //The user is logged in.
     $debug->add('6');
     define('NAME', $_SESSION['firstName'] . ' ' . $_SESSION['lastName'], 1);
     //getMaintMode();
     if ($_SESSION['siteRoleId'] == 5) {
         setcookie('noGoogleAnalytics', 'donotcountme', time() + 60 * 60 * 24 * 365, COOKIEPATH, COOKIEDOMAIN, false);
         //1 year
     }
     reconcileLists($_SESSION['userId']);