예제 #1
0
   $direccion = $_POST['dire'];
   $rfc = $_POST['rfc'];
   $neo_User = new Usuario($tipo, $nombre, $passw, $email, $tipo_numero, $telefono, $direccion, $rfc);
   $soncof = $Base->addElement($neo_User);

   return $soncof;
 }

function login(){
$nombre = $_POST['nombre'];
$passw = $_POST['pass'];
if(($nombre !="") && ($passw != "")){
}

}

if(($_SERVER['HTTP_REFERER']) == ("http://localhost/PoloCase/Form.html")){

if(Register($myBase)){
   header('Location: Succerfull.html');
}

}else{
  if(Register2($myBase)){
    header('Location: SuccerfullAdm.php');
  }

}

 ?>
예제 #2
0
function smf_openID_return()
{
    global $smcFunc, $user_info, $user_profile, $sourcedir, $modSettings, $context, $sc, $user_settings;
    // Is OpenID even enabled?
    if (empty($modSettings['enableOpenID'])) {
        fatal_lang_error('no_access', false);
    }
    if (!isset($_GET['openid_mode'])) {
        fatal_lang_error('openid_return_no_mode', false);
    }
    // @todo Check for error status!
    if ($_GET['openid_mode'] != 'id_res') {
        fatal_lang_error('openid_not_resolved');
    }
    // SMF has this annoying habit of removing the + from the base64 encoding.  So lets put them back.
    foreach (array('openid_assoc_handle', 'openid_invalidate_handle', 'openid_sig', 'sf') as $key) {
        if (isset($_GET[$key])) {
            $_GET[$key] = str_replace(' ', '+', $_GET[$key]);
        }
    }
    // Did they tell us to remove any associations?
    if (!empty($_GET['openid_invalidate_handle'])) {
        smf_openid_removeAssociation($_GET['openid_invalidate_handle']);
    }
    $server_info = smf_openid_getServerInfo($_GET['openid_identity']);
    // Get the association data.
    $assoc = smf_openID_getAssociation($server_info['server'], $_GET['openid_assoc_handle'], true);
    if ($assoc === null) {
        fatal_lang_error('openid_no_assoc');
    }
    $secret = base64_decode($assoc['secret']);
    $signed = explode(',', $_GET['openid_signed']);
    $verify_str = '';
    foreach ($signed as $sign) {
        $verify_str .= $sign . ':' . strtr($_GET['openid_' . str_replace('.', '_', $sign)], array('&' => '&')) . "\n";
    }
    $verify_str = base64_encode(sha1_hmac($verify_str, $secret));
    if ($verify_str != $_GET['openid_sig']) {
        fatal_lang_error('openid_sig_invalid', 'critical');
    }
    if (!isset($_SESSION['openid']['saved_data'][$_GET['t']])) {
        fatal_lang_error('openid_load_data');
    }
    $openid_uri = $_SESSION['openid']['saved_data'][$_GET['t']]['openid_uri'];
    $modSettings['cookieTime'] = $_SESSION['openid']['saved_data'][$_GET['t']]['cookieTime'];
    if (empty($openid_uri)) {
        fatal_lang_error('openid_load_data');
    }
    // Any save fields to restore?
    $context['openid_save_fields'] = isset($_GET['sf']) ? unserialize(base64_decode($_GET['sf'])) : array();
    // Is there a user with this OpenID_uri?
    $result = $smcFunc['db_query']('', '
		SELECT passwd, id_member, id_group, lngfile, is_activated, email_address, additional_groups, member_name, password_salt,
			openid_uri
		FROM {db_prefix}members
		WHERE openid_uri = {string:openid_uri}', array('openid_uri' => $openid_uri));
    $member_found = $smcFunc['db_num_rows']($result);
    if (!$member_found && isset($_GET['sa']) && $_GET['sa'] == 'change_uri' && !empty($_SESSION['new_openid_uri']) && $_SESSION['new_openid_uri'] == $openid_uri) {
        // Update the member.
        updateMemberData($user_settings['id_member'], array('openid_uri' => $openid_uri));
        unset($_SESSION['new_openid_uri']);
        $_SESSION['openid'] = array('verified' => true, 'openid_uri' => $openid_uri);
        // Send them back to profile.
        redirectexit('action=profile;area=authentication;updated');
    } elseif (!$member_found) {
        // Store the received openid info for the user when returned to the registration page.
        $_SESSION['openid'] = array('verified' => true, 'openid_uri' => $openid_uri);
        if (isset($_GET['openid_sreg_nickname'])) {
            $_SESSION['openid']['nickname'] = $_GET['openid_sreg_nickname'];
        }
        if (isset($_GET['openid_sreg_email'])) {
            $_SESSION['openid']['email'] = $_GET['openid_sreg_email'];
        }
        if (isset($_GET['openid_sreg_dob'])) {
            $_SESSION['openid']['dob'] = $_GET['openid_sreg_dob'];
        }
        if (isset($_GET['openid_sreg_gender'])) {
            $_SESSION['openid']['gender'] = $_GET['openid_sreg_gender'];
        }
        // Were we just verifying the registration state?
        if (isset($_GET['sa']) && $_GET['sa'] == 'register2') {
            require_once $sourcedir . '/Register.php';
            return Register2(true);
        } else {
            redirectexit('action=register');
        }
    } elseif (isset($_GET['sa']) && $_GET['sa'] == 'revalidate' && $user_settings['openid_uri'] == $openid_uri) {
        $_SESSION['openid_revalidate_time'] = time();
        // Restore the get data.
        require_once $sourcedir . '/Subs-Auth.php';
        $_SESSION['openid']['saved_data'][$_GET['t']]['get']['openid_restore_post'] = $_GET['t'];
        $query_string = construct_query_string($_SESSION['openid']['saved_data'][$_GET['t']]['get']);
        redirectexit($query_string);
    } else {
        $user_settings = $smcFunc['db_fetch_assoc']($result);
        $smcFunc['db_free_result']($result);
        $user_settings['passwd'] = sha1(strtolower($user_settings['member_name']) . $secret);
        $user_settings['password_salt'] = substr(md5(mt_rand()), 0, 4);
        updateMemberData($user_settings['id_member'], array('passwd' => $user_settings['passwd'], 'password_salt' => $user_settings['password_salt']));
        // Cleanup on Aisle 5.
        $_SESSION['openid'] = array('verified' => true, 'openid_uri' => $openid_uri);
        require_once $sourcedir . '/LogInOut.php';
        if (!checkActivation()) {
            return;
        }
        DoLogin();
    }
}
예제 #3
0
function method_sign_in()
{
    global $db_prefix, $context, $user_profile, $modSettings, $register, $sourcedir, $user_info, $boardurl, $txt;
    require_once $sourcedir . '/Register.php';
    require_once $sourcedir . '/Subs-Members.php';
    require_once $sourcedir . '/Subs-Auth.php';
    $token = $context['mob_request']['params'][0][0];
    $code = $context['mob_request']['params'][1][0];
    $email = isset($context['mob_request']['params'][2][0]) ? base64_decode($context['mob_request']['params'][2][0]) : '';
    $username = isset($context['mob_request']['params'][3][0]) ? base64_decode($context['mob_request']['params'][3][0]) : '';
    $password = isset($context['mob_request']['params'][4][0]) ? base64_decode($context['mob_request']['params'][4][0]) : '';
    // verify tapatalk token and code first
    $ttid = TapatalkSsoVerification($token, $code);
    if (empty($ttid)) {
        get_error('Tapatalk authorization verify failed, please login with your username and password.');
    }
    $tapatalk_id_email = $ttid->email;
    $result_status = true;
    $register = false;
    $result_text = '';
    if (!$ttid->result || empty($tapatalk_id_email)) {
        get_error($ttid->result_text ? $ttid->result_text : 'Tapatalk authorization verify failed, please login with your username and password');
    }
    // sign in with email or register an account
    $login_id = emailExists($tapatalk_id_email);
    if (empty($login_id)) {
        if (empty($username)) {
            get_error('Invalid Parameters', 2);
        } else {
            if (isReservedName($username, 0, true, false)) {
                get_error($txt[473], 1);
            } else {
                if (empty($password)) {
                    $password = tt_generatePassword();
                }
                $_POST['user'] = $username;
                $_POST['email'] = $tapatalk_id_email;
                $_POST['passwrd1'] = $password;
                $_POST['passwrd2'] = $password;
                $_POST['regagree'] = 'on';
                $_POST['regSubmit'] = 'Register';
                $_POST['skip_coppa'] = 1;
                $_SESSION['old_url'] = $boardurl;
                $modSettings['disable_visual_verification'] = 1;
                $modSettings['recaptcha_enabled'] = 0;
                $modSettings['recaptcha_enable'] = 0;
                $modSettings['captchaenable'] = 0;
                // compatibility with old CAPTCHA Mod
                $modSettings['anti_spam_ver_enable'] = false;
                if ($modSettings['registration_method'] == 1) {
                    $modSettings['registration_method'] = 0;
                }
                $login_id = Register2();
                $register = true;
                $result_status = $modSettings['registration_method'] == 2 ? false : true;
                $result_text = $modSettings['registration_method'] == 2 ? $txt['approval_after_registration'] : '';
                if (empty($login_id)) {
                    get_error('Register failed');
                }
            }
        }
    }
    // do login
    if ($login_id) {
        $request = db_query("\n            SELECT passwd, ID_MEMBER AS id_member, is_activated, ID_GROUP AS id_group, emailAddress AS email_address, additionalGroups AS additional_groups, memberName AS member_name,\n                passwordSalt AS password_salt, ID_POST_GROUP\n            FROM {$db_prefix}members\n            WHERE ID_MEMBER = '{$login_id}'\n            ", __FILE__, __LINE__);
        $user = mysql_fetch_assoc($request);
        if ($user['is_activated'] == 3 && !$register) {
            fatal_lang_error('still_awaiting_approval');
        }
        // Set the login cookie
        setLoginCookie(60 * $modSettings['cookieTime'], $login_id, sha1($user['passwd'] . $user['password_salt']));
        loadMemberData($user['id_member'], false, 'profile');
        $user_info = $user_profile[$user['id_member']];
        $user_info['is_guest'] = false;
        $user_info['is_admin'] = $user['id_group'] == 1 || in_array(1, explode(',', $user['additional_groups']));
        $user_info['id'] = $user['id_member'];
        if (empty($user_info['additionalGroups'])) {
            $user_info['groups'] = array($user_info['ID_GROUP'], $user_info['ID_POST_GROUP']);
        } else {
            $user_info['groups'] = array_merge(array($user_info['ID_GROUP'], $user_info['ID_POST_GROUP']), explode(',', $user_info['additionalGroups']));
        }
        $user_info['groups'] = array_unique(array_map('intval', $user_info['groups']));
        // Banned?
        is_not_banned(true);
        // Don't stick the language or theme after this point.
        unset($_SESSION['language']);
        unset($_SESSION['ID_THEME']);
        // You've logged in, haven't you?
        updateMemberData($user_info['id'], array('lastLogin' => time(), 'memberIP' => '\'' . $user_info['ip'] . '\'', 'memberIP2' => '\'' . $_SERVER['BAN_CHECK_IP'] . '\''));
        // Get rid of the online entry for that old guest....
        db_query("\n            DELETE FROM {$db_prefix}log_online\n            WHERE session = 'ip{$user_info['ip']}'\n            LIMIT 1", __FILE__, __LINE__);
        $_SESSION['log_time'] = 0;
        loadPermissions();
        update_push();
        // We got this far? return a positive response....
        outputRPCLogin($result_status, $result_text);
    } else {
        get_error('Sign In Failed');
    }
}