SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    What is best way to set a Weekly & Monthly alarm?

    Hi,

    Let me get just right into what we need to get done. We need a Php code that sends alert to our member as per Alerts that
    they have set up for their events. Which events they can schedule to happen Weekly, Monthly or on a fixed date.
    On a fixed date, no problem, we got that running with a Cron that runs hourly and checks for all Alerts that need to be sent
    out as per events that are due on a given date that are X Hours from current Hour.

    What I am having difficulty with is with the Weekly & Monthly event alerts.
    Example:

    1) John has an event that happens every Friday, at 9PM, and he wants his event subscribers to be alerted, which we do via email, 6 Hours before
    start of the event as to the XYZ info about this event.

    2) Jane has an event that happens on 30th of each Month, and she wants her event subscribers to be alerted 24 Hours before
    start of the event as to the XYZ info about this event. NOTE: February has no 30th day.

    How would you code this?

    Anoox search engine volunteer

    www.anoox.com

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,603
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Set up a php script as a cron job to execute at a regular interval, have the script check to see it matches the conditions you want, then have it send the email.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Wizard WorldNews's Avatar
    Join Date
    Nov 2007
    Posts
    1,033
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well as I wrote we have a Php Script via a Cron Job that checks to see the conditions match for the fixed date, one time, events.
    My question was/is:

    what conditions to check in case of Weekly & Monthly recurring events?



    Quote Originally Posted by Force Flow View Post
    Set up a php script as a cron job to execute at a regular interval, have the script check to see it matches the conditions you want, then have it send the email.

    Anoox search engine volunteer

    www.anoox.com

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How are you storing the events information?

  5. #5
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,603
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by WorldNews View Post
    what conditions to check in case of Weekly & Monthly recurring events?
    The conditions would be whatever you specify in your PHP code pulled from wherever your data is stored. Here's a little bit of pseudocode that might better illustrate what I mean:


    Code:
    if($thesubscriber=="john" && $today=="Friday" && $time=="9:00PM EST"){
         sendmail();
    }
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain


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
  •