title: Restricting file running via cron job from direct access
body: <p>I need advise regarding safeguarding a file i created that runs on via cronjobs.</p>
  
  <p>Currently, i'm using HTTP_referrer from preventing direct access from unauthorised person. But will this also prevent my cron jobs from executing it as well. </p>
  
  <p>I inserted the following code at the top of my script:</p>
  
  <pre><code>    if(empty($_SERVER['HTTP_REFERER'])){
          echo 'Restricted Access';
          exit;
      } 
  </code></pre>
  
  <p>Is this secure and will it prevent access from my cron? Any help appreciated. Thanks.</p>