0

I created an IOS WebApp with password protected the main page(using php) and user have to type the password once per day. The password protected main page works on safari(ask for password once per day) but after adding it to Home Screen the WebApp keeps asking password each time i minimize the app and re open it . In another word the script doesn't remember the password from cookie so it keep asking it again if the app is minimized ! Could any one tell me why the webApp keep asking the password on minimization?Thanks in advance.

I added this on the top of my main page webApp:

<?php include("/protect.php"); ?>

And inside protect.php i take user name and password via form and save it on cookie after validation:

setcookie("verify", md5($login.'%'.$pass), $timeout, '/');

And this is how i check for cookie:

// check if password cookie is set
  if (!isset($_COOKIE['verify'])) {
    showLogin("");
  }
user1788736
  • 2,727
  • 20
  • 66
  • 110
  • I think this could be an answer: http://stackoverflow.com/a/26006163/4298881 – Surely Mar 06 '16 at 17:11
  • Thanks for your reply but my landing page is php page and it already created cookie and i can navigate to diffrent php pages using same cookie without asking for password ! Problem is that if i relunch the home screen webview it does't restore the stored cookie! Is there any solution for it using php ? – user1788736 Mar 06 '16 at 18:34
  • from the link, it said that if relaunching an app, the cookie in the app's webview will not be persist. – Surely Mar 07 '16 at 02:45

1 Answers1

0

I fixed the problem by making $timeout not equal to zero!

user1788736
  • 2,727
  • 20
  • 66
  • 110