By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

New Message Notification

P: 16
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?
May 29 '07 #1
Share this Question
Share on Google+
5 Replies


ak1dnar
Expert 100+
P: 1,584
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.
May 29 '07 #2

P: 16
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.
May 30 '07 #3

ak1dnar
Expert 100+
P: 1,584
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.
May 30 '07 #4

P: 16
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.
May 30 '07 #5

ak1dnar
Expert 100+
P: 1,584
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>.
May 30 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.