How to use check for session and http referer? : <p>I'd like to check for both session and http referer but it's not working for me.</p>

<p>First page:</p>

<pre><code>&lt;?php
session_start();
$_SESSION['something'] = '1';
?&gt;
</code></pre>

<p>Second page:</p>

<pre><code>&lt;?php
session_start();
  if(!strpos($_SERVER["HTTP_REFERER"], "some referer")){

    die(header("Location: my site"));
  }

  if(!isset($_SESSION['something'])){

      die(header("Location: my site"));
  }

session_destroy();
// rest code
</code></pre>

<p>What am I doing wrong?</p>
