<?php
require_once dirname(__DIR__) . '/config.php';
session_start();

$type = $_GET['type'] ?? '';
$allowed = ['qq', 'wx', 'alipay'];
if (!in_array($type, $allowed)) {
    die('无效的登录方式');
}

// 保存绑定标记
$_SESSION['oauth_bind'] = true;
$_SESSION['oauth_bind_user_id'] = $_SESSION['user_id'];

// 跳转到彩虹聚合登录
header('Location: /api/union_login.php?type=' . $type);
exit;