...

View Full Version : log file autoemailed to me??



kab_184
10-26-2003, 07:49 AM
hi

i made my site in PHP ..the log file is created daily on my site.it is a simple .txt file

the prefix for the file is based on date on the server for example

if the date on the server is 10.23.2003 then the log file for that day will be 10.23.2003.txt .Now as the sever date changes a new text file is created and it starts recording the log data..


now i want some script to automail me that last day text file once

does any one know what Code or way it can b done??i want the file to b mailed to my address only once automatically.

SDP2006
10-26-2003, 01:21 PM
You will have to write cron job to execute the script to mail it to you at a certain time of each day....

Acecool
10-26-2003, 03:32 PM
If 1 person visits your site every 24 hours, you could set up well, a sort of "job"

use a mysql db, then time sent

Duration of time Time in Seconds
One Second 1
One Minute 60
One Hour 3600
One Day 86400

If time last sent is <= less than or equal to 86400 in the mysql db, then mail the thing and write new time sent.
no need for an else.

SDP2006
10-26-2003, 03:45 PM
That wouldn't work. The script would have to be ran manually for that to happen. If you wanted the script to mail it at 2 AM, then you would have to have someone run the script at 2 AM. With a cron job, It will run automatically....

Acecool
10-26-2003, 04:07 PM
Yes, but for people without cron (people using windows (for a server... lol...))
then if you site gets 1 user each 24 hours minimum thenit will run, if you get alot more then it should work.

Nightfire
10-26-2003, 04:14 PM
You could do it without cron, if it was only to be sent once a day and not at an exact time. Could just use a db and once someone visits the site for the first time that day, update a table field to make the query never execute again for that day.

<edit> I guess I shouldn't leave the reply page on for so long, basically saying the same as acecool did</edit>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum