简体   繁体   中英

How to password protect ios WebApp(webView) page?

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("");
  }

我通过使$ timeout不等于零来解决了这个问题!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM