( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/..//tmpr/../tmpr/../tmpr/..//looksy/test_session_sharing.php
<?php
require_once 'config/config.php';

echo "<h1>Session Sharing Test</h1>";

// Set a test value in session
$_SESSION['test_value'] = 'main_app_' . time();

echo "<h2>Main App Session</h2>";
echo "<pre>";
echo "Session ID: " . session_id() . "\n";
echo "Session Name: " . session_name() . "\n";
echo "Session Path: " . session_get_cookie_params()['path'] . "\n";
echo "Test Value: " . $_SESSION['test_value'] . "\n";
echo "User ID: " . ($_SESSION['user_id'] ?? 'Not set') . "\n";
echo "Username: " . ($_SESSION['username'] ?? 'Not set') . "\n";
echo "All Session Data:\n";
print_r($_SESSION);
echo "</pre>";

echo "<h2>Test API Session Access</h2>";
echo "<p>Click the button below to test if the API can access the same session:</p>";

if (isset($_POST['test_api'])) {
    echo "<h3>API Test Result:</h3>";
    
    // Use cURL to test the API session access
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://localhost/looksy/api/test_session.php');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_COOKIE, session_name() . '=' . session_id());
    
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    echo "<p>HTTP Status: $httpCode</p>";
    echo "<pre>" . htmlspecialchars($response) . "</pre>";
}
?>

<form method="POST">
    <button type="submit" name="test_api" value="1">Test API Session Access</button>
</form>

<style>
body { font-family: Arial, sans-serif; margin: 20px; }
h1, h2, h3 { color: #333; }
pre { background: #f5f5f5; padding: 10px; border-radius: 5px; overflow-x: auto; }
button { padding: 10px 20px; background: #007cba; color: white; border: none; border-radius: 3px; cursor: pointer; }
</style>