Hey all. I have a PHP script that is run on macintosh computers with a frontend GUI to it made using Platypus and CocoaDialog (google em'). It's a long story, but the script may break when a certain event happens, and I was wondering if it was possible to make a remote killswitch for the script to disable it (using the die() function) remotely, preferably by accessing a file on my server every time the script is run. My script is compiled into an executable with Platypus, so there's no way the user can remove the line of code. That's the first thing I want to know how to do. The second is- How can I make an update notifier, that checks for an update almost like the killswitch but instead, informs the user that there is an update available. I'd have a variable in each update I release that says like $Version = 2.2; and then it would see if there is a newer version available by querying a file on a server. Sadly, I am not very PHP-savvy and have really no idea how to do this. Can anyone give me an example or some kind of guidance as to how I can accomplish these two things?
Thanks,
Andy
Need help with a couple things
Moderator: General Moderators
Re: Need help with a couple things
Well yeah, that's how you'd do it. A simpleandyh2 wrote:I was wondering if it was possible to make a remote killswitch for the script to disable it (using the die() function) remotely, preferably by accessing a file on my server every time the script is run.
Code: Select all
if (file_get_contents("http://yoursite.com/disable.txt")) die("kill switch");Of course it does mean that your server is queried every time the code runs.
Same idea, same drawback.andyh2 wrote:How can I make an update notifier, that checks for an update almost like the killswitch but instead, informs the user that there is an update available. I'd have a variable in each update I release that says like $Version = 2.2; and then it would see if there is a newer version available by querying a file on a server.
Code: Select all
$version = 2.2;
$newest = file_get_contents("http://yoursite.com/version.txt");
if ($newest > $version) { /* there is a newer version available */ }