Beispiel #1
0
    exit;
}
try {
    $request = $_GET + $_POST;
    if (!isset($request['cmd']) || !isset($request['provider'])) {
        //script called incorrectly
        throw new Exception("Social login authenticator called incorrectly", "1001003");
    }
    $providerToken = ucfirst(strtolower(htmlentities($request['provider'])));
    //hybridauth requires providers be all lowercase with the first letter capitalized
    $provider = MM_ExtensionsFactory::getExtension($providerToken);
    if (is_null($provider) || !$provider instanceof MM_AbstractSocialLoginExtension || !$provider->isActive()) {
        //can't access requested provider
        throw new Exception("Requested Social Login Provider not found", "1001004");
    }
    if ($request['cmd'] == "login") {
        processLogin($request, $provider);
        exit;
    } else {
        if ($request['cmd'] == "signup") {
            processSignup($request, $provider);
            exit;
        }
    }
} catch (Exception $e) {
    //redirect to error page
    $url = MM_CorePageEngine::getUrl(MM_CorePageType::$ERROR, MM_Error::$ACCESS_DENIED) . "&slcode={$e->getCode()}";
    MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "Exception encountered in social login: Code={$e->getCode()}, Message={$e->getMessage()}");
    wp_redirect($url);
    exit;
}
Beispiel #2
0
<?php

require_once 'header.php';
require_once '../classes/User.php';
if (isset($_SESSION['email'])) {
    header("Location: welcome.php");
}
if (!isset($_POST['signup'])) {
    outputSignupForm("");
} else {
    $errorMessage = processSignup();
    if ($errorMessage) {
        outputSignupForm($errorMessage);
    } else {
        header("Location: welcome.php");
    }
}
function processSignup()
{
    if (empty($_POST['email']) || empty($_POST['passwd']) || empty($_POST['repeatpasswd']) || empty($_POST['firstname']) || empty($_POST['lastname']) || empty($_POST['age']) || empty($_POST['sex'])) {
        return "fill all the values";
        //return errormessage
    } else {
        if ($_POST['passwd'] != $_POST['repeatpasswd']) {
            return "password mismatch";
        } else {
            if (User::isEmailUsed($_POST['email'])) {
                return "email is already used";
            } else {
                $user = User::insertToDatabase($_POST['email'], $_POST['passwd'], $_POST['firstname'], $_POST['lastname'], $_POST['age']);
                if (!$user) {
Beispiel #3
0
<?php 
require_once 'header.php';
require_once 'menubar.php';
require_once 'userstatus.php';
if (isset($_SESSION['email'])) {
    header("Location: start.php");
}
if (!isset($_POST['signup'])) {
    outputSignupForm("");
} else {
    $errorMessage = processSignup($conn);
    if ($errorMessage) {
        outputSignupForm($errorMessage);
    } else {
        header("Location: start.php");
    }
}
function processSignup($connection)
{
    if (empty($_POST['email']) || empty($_POST['passwd']) || empty($_POST['repeatpasswd']) || empty($_POST['firstname']) || empty($_POST['lastname']) || empty($_POST['age']) || empty($_POST['sex'])) {
        return "fill all the values";
        //return errormessage
    } else {
        if ($_POST['passwd'] != $_POST['repeatpasswd']) {
            return "password mismatch";
        } else {
            $email = $_POST['email'];
            $sqlCommand = "SELECT * FROM Users WHERE Email='{$email}'";
            $result = mysql_query($sqlCommand, $connection);
            if (!$result) {
                return mysql_error();