1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Christmas Conundrum

Discussion in 'Programming' started by dp-user-1, Nov 4, 2009.

  1. #1
    EDIT: Solved through the use of cookies.

    Hello everyone,

    If you look in my signature, you'll see a link to a Christmas countdown website I've recently created. Everything works right now, but something occurred to me last night:

    I use PHP to determine if it is Christmas or not, and subsequently to determine what to display on the page (head and body). But PHP (as I'm sure you know) takes only the server's time into account. Christmas (as I'm also sure you know) doesn't occur at the same hour world-wide.

    I came up with a solution that works as follows:

    If the PHP variables are undefined, a JavaScript function is called to create them based on the client-side date and time. The values are then sent via POST back to the page and picked up by the PHP.

    Of course, the variables need to be accurate and up-to-date; however, the POST data is persistent. When the page is refreshed or reloaded, this creates an obvious problem (plus an annoying warning message in the browser). With no way to clear the POST data after I've used it, I'm stuck...

    I'm trying to avoid using GET.

    Solutions?

    Thanks,
    Peter
     
    Last edited: Nov 4, 2009
    dp-user-1, Nov 4, 2009 IP