I've just created a web app on my iPhone. I can open it and log in with no problem, but whenever I return to the app it has forgotten my previous session and I have to re-enter my username and password.
There have been a few other questions about this, but their answers haven't helped me to solve the problem because I'm not sure where to put the PHP that was provided.
This is the best answer that I've found: Maintain PHP Session in web app on iPhone
In the answer, Wilbo Baggins (https://stackoverflow.com/users/346440/wilbo-baggins) provides the following code:
// Start or resume session
session_start();
// Extend cookie life time by an amount of your liking
$cookieLifetime = 365 * 24 * 60 * 60; // A year in seconds
setcookie(session_name(),session_id(),time()+$cookieLifetime);
I entered that code between <?php
and ?>
tags in the website's header, but that hasn't solved the issue. I'm guessing that I'm putting it in the wrong place, so I'm looking for guidance that will explain where I should actually be putting it.
Thanks.
--
BUMP: Is there anyone out there who can help me solve this issue or, at the very least, knows how I can get in touch with Wilbo Baggins (https://stackoverflow.com/users/346440/wilbo-baggins)?