php - Setting a timeout for a session after a user has logged in -


I need to close an entrance page if a user has been deactivated for a certain amount of time That's got to be. I think setting up session variables for cookies would be the best way to do this (if there is a better way or my path is wrong, please let me know). The problem is that the session is being deleted and cookies are not set before running the script. Can I move the narration on the bottom of the page? Do I also need a statement? Am I doing this right? thank you in advanced.

  & lt ?? Php is required ("../ contains / include header.php"); $ End = time () + 90; Setkey ("user", $ _SESSION ["user"], $ end); Setkey ("image", $ _SESSION ["image"], $ end); Setkey ("program", $ _SESSION ["program"], $ termination); Setkey ("email", $ _SESSION ["email"], $ end); Setkey ("role", $ _SESSION ["role"], $ end); If ($ end) {unset ($ _COOKIE ["user"]); Not set ($ _cookie ["image"]); Not set ($ _cookie ["program"]); Not set ($ _cookie ["email"]); Not set ($ _cookie ["role"]); Session_destroy (); The echo "session is over."; }? & Gt; & Lt; Body & gt; & Lt; Div id = "page" & gt; & Lt; Header & gt; & Lt; Div id = "logo" category = "logo_big" & gt; & Lt; / Div & gt; & Lt; Div id = "fsi_logo" class = "logo_bg" & gt; & Lt; / Div & gt; & Lt; / Header & gt; & Lt; Div id = "main" & gt; & Lt; Div id = "instructor" & gt; & Lt ;? Php echo "& lt; img id = instructor_image src =". $ _COOKIE ["Image"]. "& Gt;"; Echo "& lt; h1 & gt;" . $ _COOKIE ["user"]. "& Lt; / h1>"; Echo "& lt; span & gt; & lt; p & gt;" . $ _COOKIE ["Program"] "& Lt; / p> - - & lt; h2 & gt; . $ _COOKIE ["Roles"]. " & lt; / span & gt;"; Echo "& lt; a href = mailto:". $ _COOKIE ["Email"]. "& Gt;" . $ _COOKIE ["Email"]. "& Lt; / a & gt;"; ? & Gt; & Lt; / Div & gt; & Lt ;? Php is required ("../ included / footer html"); ? & Gt;  

In your example ($ termination) is always true if you end up in a session When you store the time, you do not need to move it to the bottom of the page. Something like this:

  if (! Isset ($ _ session ["expired"])) {$ _SESSION ["expired"] = time () + 90; // It will add 90 seconds though ... // more set logic} elseif ($ _ session ["expired"]> LET; time ()) {// unset logic} else {refresh timer}    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -