Connecting Tech Pros Worldwide Forums | Help | Site Map

Send mail listing the maximum number of users online on a particular date

Newbie
 
Join Date: Jul 2007
Posts: 13
#1: Aug 24 '07
Hello All,

I have a table where i am maintaining the users' ip address and the date when they are accessing the website.

so its like i have 3 fields in the table like

ip_id - auto_increment not null primary key
ip_address - holds the ip address of the user browsing the site
date - the particular date when the user was online on the website

I now need to get the entire list of users and their ip addresses who browsed the website for a particular day.

and this list of users' ip addresses needs to be sent in a mail to the admin of the site.

Any ideas how to go about it?

Regards,
Dream2rule

nathj's Avatar
Expert
 
Join Date: May 2007
Location: North Tyneside
Posts: 857
#2: Aug 24 '07

re: Send mail listing the maximum number of users online on a particular date


Quote:

Originally Posted by dream2rule

Hello All,

I have a table where i am maintaining the users' ip address and the date when they are accessing the website.

so its like i have 3 fields in the table like

ip_id - auto_increment not null primary key
ip_address - holds the ip address of the user browsing the site
date - the particular date when the user was online on the website

I now need to get the entire list of users and their ip addresses who browsed the website for a particular day.

and this list of users' ip addresses needs to be sent in a mail to the admin of the site.

Any ideas how to go about it?

Regards,
Dream2rule

Hi,

You could select the ip addresses frm the table with an appropriate where clause:
[php]
// $ldDate is defined as the date you are searching for
$lcSelect="Select ip_address from table_name where date = $ldDate";

// run the query
[/php]
You can loop through the resuls of the sql building up the message of your email.

The mail could be sent using the php mail() class. It's really a case of a simple SQL query followed by a loop to process the results.

Have a go at that and if you get stuck post your code and I'll try to help you out some more.

Cheers
nathj
Newbie
 
Join Date: Jul 2007
Posts: 13
#3: Aug 27 '07

re: Send mail listing the maximum number of users online on a particular date


i got the working of the mail but i need to know how do i sent it only once in a day i.e preferably all the users online throughout the day and their corresponding addresses needs to be sent to the administrator everyday.. I have the system date. Any help?
nathj's Avatar
Expert
 
Join Date: May 2007
Location: North Tyneside
Posts: 857
#4: Aug 28 '07

re: Send mail listing the maximum number of users online on a particular date


Quote:

Originally Posted by dream2rule

i got the working of the mail but i need to know how do i sent it only once in a day i.e preferably all the users online throughout the day and their corresponding addresses needs to be sent to the administrator everyday.. I have the system date. Any help?

It seems that you want to fire an event to gather data and send and email regarding that data based on time rather than page impressions or user clicks.

The low tech colution would be to have a process that does what you're after that you call manually - I said low tech. This would at least prove to you that the system works.

then moving on from there you need some sort of timer based process. This is not something I have ever done, but it does sound interesting. Perhaps your web host has some facility for this. I belive under Unix system Cron is the way to do this. As I say I have no experience in this at all so I don't pretend to be an expert here.

Sorry I can't be any more help.

Cheers
nathj
Reply