icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » All Things Techy » Site Maintenance » send a file when timestamp changes?

Site Maintenance Program updates, securing your website, creating backups.

Reply
 
LinkBack Thread Tools Search this Thread
Old June 6th, 2005, 3:25 PM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Apr 2004
18 posts
Gave thanks: 0
Thanked 0 times
send a file when timestamp changes?

I have a cron job that runs a php script that sends me the contents of a file. is there any way to have that file sent only when the timestamp changes?
__________________
Server: Sonet
po00oq is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 6th, 2005, 3:57 PM   #2 (permalink)
Registered User
Fresh Surpasser
 
Joined in Apr 2004
18 posts
Gave thanks: 0
Thanked 0 times
Nevermind.. I have solved the problem.

IN the php file that writes to the file I want to send, I added the date command and had it write to the invoicedate.txt than

in the cron php script, I added

PHP Code:
<?php
$filename 
'date.txt';
$fp fopen($filename"r");
$date fread($fpfilesize($filename));
fclose($fp);

$filename 'invoicedate.txt';
$fp fopen($filename"r");
$invoicedate fread($fpfilesize($filename));
fclose($fp);

if (
$invoicedate != $date){
//add mail script here

$filename 'date.txt';
$fp fopen($filename"w");
$string $invoicedate;
$write fputs($fp$string);
fclose($fp);
}

?>
__________________
Server: Sonet
po00oq is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 6th, 2005, 4:42 PM   #3 (permalink)
Surpass Fan
Super #1
 
Joined in Aug 2004
Hosted on SH58
1,688 posts
Gave thanks: 6
Thanked 7 times
you could also use filemtime() to get the time when the date was last modified.
__________________
- Evan Charlton | [site] | Server - SH58
Kickersny.com is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 6th, 2005, 5:02 PM   #4 (permalink)
Registered User
Fresh Surpasser
 
Joined in Apr 2004
18 posts
Gave thanks: 0
Thanked 0 times
thanks......that would be too easy wouldn't it
__________________
Server: Sonet
po00oq is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 6th, 2005, 11:25 PM   #5 (permalink)
Surpass Fan
Super #1
 
Joined in Aug 2004
Hosted on SH58
1,688 posts
Gave thanks: 6
Thanked 7 times
Haha, there's nothing wrong with making too much sense
__________________
- Evan Charlton | [site] | Server - SH58
Kickersny.com is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 7th, 2005, 12:48 PM   #6 (permalink)
sam
Surpass Fan
Super #1
 
sam's Avatar
 
Joined in Dec 2003
Lives in NJ
5,057 posts
Gave thanks: 0
Thanked 4 times
one more post from Kickersny.com and its quadruple digits.
sam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On