Partner Matching
No more founders found for now.
Check back later!
prepare("SELECT onboarding_completed FROM users WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(); if (!$user['onboarding_completed']) { header("Location: founder_onboarding.php"); exit; } $current_user_id = $_SESSION['user_id']; // Handle Swipe via AJAX/POST if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe') { $swiped_id = (int)$_POST['swiped_id']; $direction = $_POST['direction']; // 'like' or 'dislike' if ($swiped_id > 0 && in_array($direction, ['like', 'dislike'])) { $stmt = db()->prepare("INSERT IGNORE INTO swipes (swiper_id, swiped_id, direction) VALUES (?, ?, ?)"); $stmt->execute([$current_user_id, $swiped_id, $direction]); // Check for match if ($direction === 'like') { $stmt = db()->prepare("SELECT id FROM swipes WHERE swiper_id = ? AND swiped_id = ? AND direction = 'like'"); $stmt->execute([$swiped_id, $current_user_id]); if ($stmt->fetch()) { // It's a match! $stmt = db()->prepare("INSERT IGNORE INTO matches (user1_id, user2_id) VALUES (?, ?)"); $u1 = min($current_user_id, $swiped_id); $u2 = max($current_user_id, $swiped_id); $stmt->execute([$u1, $u2]); // Add notification $stmt = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)"); $stmt->execute([$swiped_id, "You have a new match!"]); $stmt->execute([$current_user_id, "You have a new match!"]); echo json_encode(['status' => 'success', 'match' => true]); exit; } } echo json_encode(['status' => 'success', 'match' => false]); exit; } } // Fetch founders to swipe on $stmt = db()->prepare(" SELECT * FROM users WHERE role = 'founder' AND id != ? AND onboarding_completed = 1 AND id NOT IN (SELECT swiped_id FROM swipes WHERE swiper_id = ?) LIMIT 10 "); $stmt->execute([$current_user_id, $current_user_id]); $founders = $stmt->fetchAll(); $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; ?>
No more founders found for now.
Check back later!
You and this founder both swiped right on each other.