コード例 #1
0
function getLoginInfo($email, $password)
{
    $user = getUserByEmail($email);
    if ($user == null || $password != $user->password) {
        return invalidLogin();
    }
    $eventIds = $user->sharedEvent;
    $events = array();
    foreach ($eventIds as $key => $value) {
        $events[] = R::exportAll($value);
        $dates[$key] = $value['startdate'];
    }
    if (count($events) > 0) {
        array_multisort($dates, SORT_ASC, $events);
    }
    return array(ID => $user->id, USER_FNAME => $user->firstname, USER_LNAME => $user->lastname, USER_EMAIL => $user->email, USER_USEF_ID => $user->usefid, USER_EVENTS => getUserEvents($user->id, $eventIds));
    //count($events) > 0 ? $events : null);
}
コード例 #2
0
ファイル: login.php プロジェクト: AlexArendsen/sandpiper
            $s->bind_result($uid, $upid, $pwd, $uname, $isAdmin);
            if ($s->execute()) {
                if ($s->fetch() && $uid && $pwd) {
                    if (password_verify($_POST['password'], $pwd)) {
                        $_SESSION['LOGIN_FAILS'] = 0;
                        $_SESSION['user'] = intval($uid);
                        $_SESSION['userPublic'] = $upid;
                        $_SESSION['username'] = $uname;
                        $_SESSION['isAdmin'] = $isAdmin;
                        header("Location: index.php");
                    } else {
                        invalidLogin($twig, "Invalid Login", $arg);
                    }
                    // Username found, password mismatch
                } else {
                    invalidLogin($twig, "Invalid Login", $arg);
                }
                // Username not found
            } else {
                homeError($twig, "Internal System Error", $arg);
            }
            // Error while executing prepared statement
            $s->close();
        } else {
            homeError($twig, "System error. Contact system administrator.", $arg);
        }
        // Error while preparing statement. DB probably isn't install; run install/install.sql
    } else {
        homeError($twig, "Please enter username and password", $arg);
    }
}