Results 1 to 6 of 6

Thread: Code to display a message if executed after a certain date?

  1. #1
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Code to display a message if executed after a certain date?

    Hi,

    I want to put a time limit on accessing certain pages of an internal company website. e.g. If a certain date is reached then the user is prompted to contact me for an updated link - rather than possibly viewing out of date information.

    I guess what I need is code to do a date check & then either direct the user to the right page or display a message.

    Can anyone help please?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If a certain date is reached then the user is prompted to contact me for an updated link - rather than possibly viewing out of date information.
    This should never be needed. Out-of-date pages you still want to keep around should be archived neatly and replaced. To use a script for this purpose would indicate neglect and bad design by the webmaster (presumably you).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default A little background to this may help you understand where I'm coming from...

    Twey,

    I appreciate your comments re keeping things tidy. However, the scenario I'm faced with relates to a number of different users, within my company, accessing the same 'supplier pricing' page(s).

    In this specific case, I need to be able to specify a date that creates an event. This event will give certain users (they know who they are!) the option to go to a "head's-up" page with business related rebate info. It's important that this trigger happens when I need it to.

    Thanks again, in advance, for your help in suggesting code for this.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Very well.
    Code:
    function checkDateExceeded(expires, func) {
    // expires is a string in MM/DD/YYYY format
    // func is a function object to call
      var now = new Date();
      if(now.getTime() >= Date.parse(expires)) func();
    }
    Last edited by Twey; 01-21-2006 at 02:29 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Oct 2005
    Location
    Liverpool, UK
    Posts
    87
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Wink

    Thank you - I'll give it a whirl !!

    I'll be back soon with another one no doubt .... it's all a far cry from my old days of Modula2, Turbo Pascal & Cobol ... bit I'm getting there!

    Cheers,

    N.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Actually, I made an error. Edited.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •