-4

I am trying to make my session in dreamweaver last longer, but I'm not sure how?

There is some code like:

if (!isset($_SESSION)) {
     session_start();
}

Should I change the value or add anything?

The problem that I'm having is that when the user logs in and if he visits another page, he will get logged out.

Im new to php and that, thanks for any answers.

chris85
  • 23,846
  • 7
  • 34
  • 51
Denny123
  • 13
  • 2
  • 3
    That's got nothing to do with Dreamweaver (or javascript or mysql for that matter). That's a setting in PHP. – Geoff Atkins Mar 18 '16 at 12:03
  • Is the session set on the other page? Is the session correctly getting set on log in? – chris85 Mar 18 '16 at 12:14
  • When a user logs in and visits another page does not imply anything with the session "not lasting long enough". E.g. I can visit another page 10 seconds after I log in, would that make the session disappear? – apokryfos Mar 18 '16 at 12:31

1 Answers1

0

I had a similar issue with $_SESSION when i first used it the other day. You will need to call session_start() EVERY time you wish to call something from it. Just add this above your call to $_SESSION.

<?php
    session_start();
?>
Dan Bull
  • 3
  • 2