Jump to content

Can i set a session on a page?


virtuexru

Recommended Posts

Like say I want to update a page that has a countdown on it for a number... The max for that number is 800 for instance.. I set that to be the maximum, then if the number on the page is less than that, I can add 100 every 30 minutes until it is equal to or greater than 800.

 

How would I go about doing this in PHP without having to manage the page after I set the initial maximum?

Link to comment
https://forums.phpfreaks.com/topic/150964-can-i-set-a-session-on-a-page/
Share on other sites

I don;t know exactly what you are asking but I cooked something up quickly.

 

session_start();
if(isset($_SESSION['number']) {

    // do some checks and do other things
    $thirtyMins = 60*30;
    if(isset($_SESSION['last']) AND time() > ($_SESSION['last'] + $thirtyMins)) {

        // update the last and number sessions

    } else {

        // no last done set the last session and do the first action to the number

    }

} else {

    // no session and do something else

}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.