Execute php script only when offline -
i have php login script thats executed top of html file. there way not execute php code when using offline?
the goal is: have webapp can cached on mobile phone. when user has no network should still possible open , use app. when offline can't connect user database authentication.
so:
- when online: execute login script
- when offline: "skip" loginscript
i thinking this:
<?php function getstatus($ip,$port){ $socket = @fsockopen($ip, $port, $errorno, $errorstr, 3); if(!$socket) return "offline"; else return "online"; } echo getstatus("sitename.com", "80"); ?>
but instead of "echo online" should execute php script, when offline "do nothing" cant "echo" php code within php code.
any ideas on how handle this?
php executed on server side, not client side. if website cached, might not contact webserver @ all.
in fact, making server execute php code while offline impossible, since won't in contact server @ all!
Comments
Post a Comment