title: PHP random link without repetitions
body: <p>My PHP is poor, but I'm trying my best to improve!!  </p>
  
  <p>I'm attempting to code a really simple php script that loads a random  html page from a text file list.  </p>
  
  <p>Once people have viewed the html page, they link back to the random.php file and it loads another page... this can continue on forever.  </p>
  
  <p>I'm using a text file list as I'll regularly be adding more pages.  My issue is there is no where in my code to prevent repeat visits!!  Right now I only have about 8 links, and on more than one occasion I've had the same link 'randomly' come up 3 times in a row :(  Hoping there is something simple I can add to this to prevent repetitions, and if all links have been viewed, then it resets.  Many Thanks :) </p>
  
  <pre><code>    &lt;body&gt;
  
      &lt;?php
      $urlist=file("randomlinks.txt");
      $nl=count($urlist);
      $np=rand(0,$nl-1);
      $url=trim($urlist[$np]);
      header("Location: $url");
      exit;
      ?&gt;
  
      &lt;/body&gt;
  </code></pre>