New Message Notification

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kidfiction
    New Member
    • May 2007
    • 16

    New Message Notification

    Hello, I recently came across this great site and discussion board.

    I am looking to create a notifier of sorts. I plan on going about this by creating a php script that scans a forum page (for example one of these forums). The php script would be in a constantly open window that refreshes itself every few minutes. The script would be looking for a new post, and if it finds a new post then notify me with a bell sound.

    I was thinking of doing this by have two variables that store all of the html on the page into one. When the page refreshes, store the html into the other and check for equivalence. If they are not equivalent, then play the sound, and store the second variable as the first and repeat. If they are equal do nothing.

    While I feel that this would work, it seems rather excessive to me. Any thoughts on how I could do this more efficiently?
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Originally posted by kidfiction
    Hello, I recently came across this great site and discussion board.

    I am looking to create a notifier of sorts. I plan on going about this by creating a php script that scans a forum page (for example one of these forums). The php script would be in a constantly open window that refreshes itself every few minutes. The script would be looking for a new post, and if it finds a new post then notify me with a bell sound.

    I was thinking of doing this by have two variables that store all of the html on the page into one. When the page refreshes, store the html into the other and check for equivalence. If they are not equivalent, then play the sound, and store the second variable as the first and repeat. If they are equal do nothing.

    While I feel that this would work, it seems rather excessive to me. Any thoughts on how I could do this more efficiently?
    Create a Session variable to store the number of posts available for the first time. next time when page refreshed calculate the number of post again and if it is mismatch with the session fire the alert. at the same time destroy the session variable that you created and recreate it for the new number of posts.

    I am not sure about the alert sound at this point. but this method might be helpful to go ahead.

    Comment

    • kidfiction
      New Member
      • May 2007
      • 16

      #3
      Originally posted by ajaxrand
      Create a Session variable to store the number of posts available for the first time. next time when page refreshed calculate the number of post again and if it is mismatch with the session fire the alert. at the same time destroy the session variable that you created and recreate it for the new number of posts.

      I am not sure about the alert sound at this point. but this method might be helpful to go ahead.
      Thank you for the help, I'm not too worried about the alert sound at the moment.
      I am having difficulty in figuring out how I would go about counting the number of posts. While I could do it for a specific forum based on the html, I am looking to create a general script that given a forum address regardless of its type (vBulletin, phpBB etc..) it would let me know whether or not a new topic or reply has been created. This is orginally why I had planned on storing all the HTML into a single (now I know to use session variables :) ) session variable and compare it to another.

      Do you have any ideas on how I could go about counting posts regardless of the forum type? Thanks again.

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        Do you have any ideas on how I could go about counting posts regardless of the forum type?
        You can use mysql_num_rows to count the number of posts available and store it in the session.

        Comment

        • kidfiction
          New Member
          • May 2007
          • 16

          #5
          Originally posted by ajaxrand
          You can use mysql_num_rows to count the number of posts available and store it in the session.
          Ah I see, I am assuming that I do not have access to the database for the forum. This is a project to have notifications for all the forums that I frequent. For example, this forum, I do not have access to the database but I would like to know when a new post has arrived.

          Comment

          • ak1dnar
            Recognized Expert Top Contributor
            • Jan 2007
            • 1584

            #6
            Are you planing to display your posts in a web page with out using a flat file or database as the back end.

            end users will add posts to the forum right?
            Then where you going to store these records? on the web page <body>.

            Comment

            Working...