{
  "id": "06",
  "content": [
    {
      "type": "heading",
      "text": "Auth Flows & Sessions (PHP/Apache)"
    },
    {
      "type": "text",
      "html": "<pre><code class='language-php'>ini_set('session.cookie_secure','1');\nini_set('session.cookie_httponly','1');\nini_set('session.use_strict_mode','1');\nini_set('session.cookie_samesite','Lax');\nsession_start();\nsession_regenerate_id(true);\n</code></pre>"
    },
    {
      "type": "text",
      "html": "<pre><code># .htaccess: add cookie flags (fallback)\n&lt;IfModule mod_headers.c&gt;\nHeader always edit Set-Cookie ^(.*)$ $1; HttpOnly; Secure; SameSite=Lax\n&lt;/IfModule&gt;\n</code></pre>"
    }
  ],
  "quiz": {
    "questions": [
      {
        "id": "q1",
        "type": "single",
        "text": "After login you should:",
        "options": [
          {
            "id": "a",
            "text": "Regenerate session ID"
          },
          {
            "id": "b",
            "text": "Disable HTTPS"
          },
          {
            "id": "c",
            "text": "Keep static session forever"
          }
        ],
        "correct": [
          "a"
        ]
      },
      {
        "id": "q2",
        "type": "single",
        "text": "Helpful cookie flags:",
        "options": [
          {
            "id": "a",
            "text": "HttpOnly, Secure, SameSite"
          },
          {
            "id": "b",
            "text": "Public"
          },
          {
            "id": "c",
            "text": "Shareable"
          }
        ],
        "correct": [
          "a"
        ]
      }
    ]
  }
}