Zend controllers with actions that need to be ran by cron but only accessible if logged in?

0 votes
asked Oct 21, 2011 by anagio

In my web app there is an administration area that has a few actions that need to be executed by cron. They can only be accessed if you are logged in. Is there anyway to access them through cron while keeping them secured so they can't be accessed directly?

1 Answer

0 votes
answered Nov 29, 2018 by aster
  1. I usually define a key in my application config and verify it in my cron related controller.

Then in my cron I call my controller through wget and I pass the key as a get parameter

  1. Another solution is to check the client is accessing your controller through a local IP see $_SERVER['REMOTE_ADDR'].

  2. Some people might recommend you to do this kind of job through a command line call (then you would check that you controller is called from command line).

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter