Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7490983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:48:08+00:00 2026-05-29T15:48:08+00:00

I am trying to make a countdown timer for a game. And the problem

  • 0

I am trying to make a countdown timer for a game. And the problem is, when the user move to another page, then countdown cannot continue the remaining time. I am trying to set a cookie and session, but I have no idea about it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:48:09+00:00Added an answer on May 29, 2026 at 3:48 pm

    Cookies are sent back and forth with every HTTP request, hence should be avoided for storing unnecessary variables.

    To maintain the timer on the server-side, a session is the best choice. It will take care of the cookie business automatically, creating only the bare-minimum cookie overhead to keep track of the session. Session variables live on the server, and are connected to HTTP requests by unique cookies.

    Regarding your countdown timer: Since you cannot keep a function running on the server to keep flipping the bits, the best bet is to keep track of the end time.

    To initiate a session in PHP, use session_start(). Then store your values in $_SESSION[] array, and they’ll persist across requests. Here’s an example:

    <?php
    session_start();
    if (!isset($_SESSION['endTime']))
    {
        $_SESSION['endTime'] = time() + 60; // end time is 60 seconds from now
        echo "Started a new timer"
    }
    else if ($_SESSION['endTime'] > time())
    {
        echo "Time left: " + ($_SESSION['endTime'] - time());
    }
    else
    {
        echo "Time is up.";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make an webapplication where you see an Ajax countdown timer. Whenever
I'm trying to make a countdown timer using JS, obviously. I think my code
I'm trying to make a countdown using C# and show the time in format:
I'm trying to make a countdown timer in my app. I already know the
I'm trying to make a countdown timer similar to the one in rapidshare using
I'm trying to make a multi-countdown on a page, which looks like : <table>
I have a countdown timer in my game and I'm trying to figure out
I am trying to make a timer for my game that counts down from
I'm trying to make a countdown timer starting at 10 minutes, similair to a
trying to make a page which will recursively call a function until a limit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.