richardjh Posted October 19, 2008 Share Posted October 19, 2008 Hello I have a script which when triggered by a cron job will dump a list of articles to my site (dumping twice a week - Monday and Friday). I've noticed that this script has started to trigger at times other than the cron settings and I am surmising that either a robot or perhaps a real human has stumbled upon the script and triggered it at these times. Is there a way to tweak the script so that it will only trigger via a cron task and not if someone or something (robot) requests the page via the browser? thanks for advice R Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/ Share on other sites More sharing options...
trq Posted October 19, 2008 Share Posted October 19, 2008 Move it out of any web accessible folder and execute it via php's cli and not via an http request. Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669477 Share on other sites More sharing options...
DeanWhitehouse Posted October 19, 2008 Share Posted October 19, 2008 Can you put the page in a folder where bots dont go, because i assume yourr site has google etc. running bots on it. Also try no-index meta tags etc. Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669478 Share on other sites More sharing options...
richardjh Posted October 19, 2008 Author Share Posted October 19, 2008 I'll look into Thorpe's idea of having the script called using cli rather than http but that approach all looks rather daunting! thanks for the advice would eregi work? e.g. if the script is called directly then have the script die? if (!eregi($PHP_SELF)) { die ("No direct access!"); } Although this bit of code doesn't seem to work but you get the gist of what I'm trying to say. Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669503 Share on other sites More sharing options...
.josh Posted October 19, 2008 Share Posted October 19, 2008 I'll look into Thorpe's idea of having the script called using cli rather than http but that approach all looks rather daunting! thanks for the advice would eregi work? e.g. if the script is called directly then have the script die? if (!eregi($PHP_SELF)) { die ("No direct access!"); } Although this bit of code doesn't seem to work but you get the gist of what I'm trying to say. So...moving a file from one folder to another is a daunting task? Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669507 Share on other sites More sharing options...
richardjh Posted October 19, 2008 Author Share Posted October 19, 2008 I've moved the file to a new folder too Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669536 Share on other sites More sharing options...
DarkWater Posted October 19, 2008 Share Posted October 19, 2008 He means outside of the webserver folders. Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669542 Share on other sites More sharing options...
DeanWhitehouse Posted October 20, 2008 Share Posted October 20, 2008 I wasn't sure whether it still works outside the webfolder, thats why i didn't say. Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669920 Share on other sites More sharing options...
DarkWater Posted October 20, 2008 Share Posted October 20, 2008 I wasn't sure whether it still works outside the webfolder, thats why i didn't say. I don't think that a lot of people who post in threads about cron actually know what it is; they just (almost) know what it does. Quote Link to comment https://forums.phpfreaks.com/topic/129134-stopping-a-script-being-manually-triggered/#findComment-669929 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.