CodeIgniter Forums
Allowing Cron to Run a controller/function but not a standard user - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Allowing Cron to Run a controller/function but not a standard user (/thread-10669.html)



Allowing Cron to Run a controller/function but not a standard user - El Forum - 08-08-2008

[eluser]Eric Cope[/eluser]
I need to run a portion of my code with a cron - only a cron. I do not want it to be ran by users. Any idea how to prevent users from running a controller function, but allowing cron?


Allowing Cron to Run a controller/function but not a standard user - El Forum - 08-08-2008

[eluser]Jilani Jidni[/eluser]
[quote author="Eric Cope" date="1218194812"]I need to run a portion of my code with a cron - only a cron. I do not want it to be ran by users. Any idea how to prevent users from running a controller function, but allowing cron?[/quote]

Use hash (encrypted) code to do this what a user won't know.


Allowing Cron to Run a controller/function but not a standard user - El Forum - 08-08-2008

[eluser]drewbee[/eluser]
I never put cron ran scripts outside of public directories, so its never really been an issue.

Though with CI, I do my own connections to the databases and like, and completely opt out of anything code igniter (since it usually is pure scripting anyways).

This is my usual structure.

/public_html/
/system/application
/cron/


Allowing Cron to Run a controller/function but not a standard user - El Forum - 08-08-2008

[eluser]Eric Cope[/eluser]
I was hoping to take advantage of the models I have already created...
If I use a new index.php file in cron, and I set a global variable there, that might work...