Page 1 of 1
Visitor Alert
Posted: Wed Apr 29, 2009 7:47 pm
by Prestyman
I'm pulling my hair out trying to write a script that seem so simple yet is not!!
I want to have a page on a website that monitors visitors to my site by alerting me when they click a link (button). Basically I want to be "logged in" to a page that then watches for a click on this link, and then plays an audio alert.
Any ideas?
Thanks!!
Re: Visitor Alert
Posted: Thu Apr 30, 2009 2:06 am
by it2051229
well? how long have you known PHP and Javascript and XML?
Re: Visitor Alert
Posted: Thu Apr 30, 2009 2:41 am
by danielwalters6
Would it not be easier to just place a small bit of email code in the header of this particular page?
http://email.about.com/cs/phpemailtips/qt/et031202.htm
This way whenever the page was accessed you would be emailed, thus your mail client would play the "ping" or whatever sound you wanted. - It wold also allow the monitoring from a mobile device capable of receiving emails.
This surely is easier to implement than creating a login area, which continually monitors(refreshes) checking for access to the page?
Let me know your thoughts
Dan
Re: Visitor Alert
Posted: Thu Apr 30, 2009 10:33 am
by Prestyman
More than a few times I have considered the email option, but wouldn't that require checking my email all the time? I mean, I realize that it could alert me when I have new mail, but what about a delay in sending the email etc? My mail server can be slow.
Also, I like to check my email twice a day only, so having it constaly monitoring for incoming email, would mean I was alerted for every email I get. I'd prefer to "know" that it was a visitor alert, and not just some SPAM
your thoughts?
Re: Visitor Alert
Posted: Thu Apr 30, 2009 10:36 am
by Prestyman
Just looking at this forum, you can see that it lets people know if they are online or offline, by changing the status button. Something like that with a audio alert would be perfect!!
But I can't seem to get my head around where to start. Yes, I am new to PHP and coding in general, but I usually have a pretty good idea of where to start and "how" it would work. I can't even see to come up with that!
Thanks again for the help.
Re: Visitor Alert
Posted: Thu Apr 30, 2009 7:42 pm
by it2051229
you mean like a messenger? that when someone goes offline or online a sound pops out or an interface pops out to notify you about it?..
Re: Visitor Alert
Posted: Thu Apr 30, 2009 9:51 pm
by Prestyman
it2051229 wrote:you mean like a messenger? that when someone goes offline or online a sound pops out or an interface pops out to notify you about it?..
Yes exactly. But of course I don't want them to have to login to anything to make it work.
Re: Visitor Alert
Posted: Fri May 01, 2009 12:07 am
by it2051229
It can be done using PHP and Mysql.
so if let's when a user visits the website's page, you set that page to store a value on the mysql database like for example the "current time".
now as the administrator, i'm assuming that the admin is viewing the admin page. The admin page keeps on refreshing in a given time interval. Let's say the admin page keeps on refreshing in every 3 seconds just to check and compare if someone has visited your website. How does it compare? you try to check the database for the stored value "the time". And that's basically it, just add the sounds...
but the idea what i've just said is kind of vague, you have to add additional stuff like keeping track of the user's IP address because everytime the user visits a page or refreshing the page you keep on getting notified and it will be quite annoying. Have you seen this websites that keeps track the number of users online, and number of users logged in? it's pretty much the same actually.
Now, i've mentioned that the page keeps on refreshing in every 3 seconds on the admin side and that would be quite inefficient don't you think? If you know how to do javascripting and AJAX, it is possible that the page will not refresh in every time interval but rather a Javascript code that keeps on counting 1 - 3 seconds everytime (in a loop). After 3 seconds, javascript does an AJAX request to server to check for new visitors, then alerts you if there's a visitor without refreshing the page.
To give you an idea, try visiting
http://www.meebo.com it's an online messenger which runs on the browser.. You observe that whenever you receive a message, you get notified via a sound and that was done using AJAX technology.
that's why i was asking how far do you know PHP, Javascript, XML, and Mysql
Re: Visitor Alert
Posted: Fri May 01, 2009 8:49 am
by danielwalters6
IT2051229 has a great idea about AJAX integration, but I still think that implementing a simple email notification would be easier.
Obviously you might get 50 emails a day from this system, so it's probably best to use a different email account/Email client.
If you're running on a slow mail server, something like Gmail is pretty quick, and free! - Just ensure the FROM address of the email is in your Gmail account's whitelist.
I'm pretty sure that running Thunderbird, with a rule to trash any emails but the ones coming from "
MYSPECIALLYCHOSENADDRESS@MYDOMAIN.COM" is easy.
Bam - you've got a solution which uses very little bandwidth (what does it take to query an empty mail box?)
Is using Free Service From Google, and Thunderbird.
AND would take less than 15 minutes to implement.
Your ISP will normally provide free email facilities?
Re: Visitor Alert
Posted: Fri May 01, 2009 10:01 am
by Prestyman
danielwalters6 and it2051229,
Both ideas are brilliant and exactly what I was looking for... a place to start! Thank you very much!!
I'll let you know how it progresses.
BR,
Clinton