Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Wouldnt It Be Handy If.......... .PHP

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

6719jason
Posts: 519
Joined: Wed 08 Apr 2009 12:38 pm
Weather Station: La-Crosse WS3502
Operating System: Windows 7
Location: Holland On Sea, Essex UK

Wouldnt It Be Handy If.......... .PHP

Post by 6719jason »

Good Evening One & All,

Wouldnt it be handy if there was a script, that could check up on the ftp file uploads and let us know when they where last updated, in realtime?

I think it would be very handy, to have a webpage in which, you could easily check that all your FTP & Realtime Files, were being updated when scheduled?

Well, look now further, I have been hard at work all day & I have come up with just the thing!

I have developed a .php script which checks up on your FTP Uploads and any other file being updated within your website!

See a sneak preview @ http://www.weeleyweatherstation.info/?page=ftpstatus

I will be releasing the file............................ NOW!

Enjoy one & all!

All files Zipped & Attached!

Jason
You do not have the required permissions to view the files attached to this post.
Last edited by 6719jason on Fri 06 Nov 2009 2:34 pm, edited 1 time in total.
6719jason
Posts: 519
Joined: Wed 08 Apr 2009 12:38 pm
Weather Station: La-Crosse WS3502
Operating System: Windows 7
Location: Holland On Sea, Essex UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by 6719jason »

Good Afternoon All!

Following a Good Nights Sleep, A Massive Response & Great Modifications to the original code,

I am releasing V1.1 & V1.2 later today.

V1.1 is now ready.

V1.2 will be released later on today.

V1.1 is a combination of my original code & a code rethink from 'Daj'.

Enjoy - Instructions & Upgrade Advice All included in Package.

Jason
You do not have the required permissions to view the files attached to this post.
6719jason
Posts: 519
Joined: Wed 08 Apr 2009 12:38 pm
Weather Station: La-Crosse WS3502
Operating System: Windows 7
Location: Holland On Sea, Essex UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by 6719jason »

Evening All,

Ver 1.2 - Slight Rewrite of original code & concept - Written by Betel_Juice & Facility to 'Ajax' Update Webpage

As before, all instructions, .php included.

Enjoy

Thank you Betel_Juice

Jason
You do not have the required permissions to view the files attached to this post.
Last edited by 6719jason on Thu 20 Aug 2009 10:28 pm, edited 1 time in total.
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by beteljuice »

... Complete rewrite of code & method ...
No, just a slight rework of your code and original useful concept Jason 8-)
Image
......................Imagine, what you will KNOW tomorrow !
6719jason
Posts: 519
Joined: Wed 08 Apr 2009 12:38 pm
Weather Station: La-Crosse WS3502
Operating System: Windows 7
Location: Holland On Sea, Essex UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by 6719jason »

Good Evening All,

A Revised Code Package - Spelling Mistakes (Fixed) & 'Ajax' Call (Fixed)

There is also a 'Wiki' on the, kindly written by Daj - http://wiki.sandaysoft.com/index.php?title=RecentUpload

Jason
You do not have the required permissions to view the files attached to this post.
Last edited by 6719jason on Mon 24 Aug 2009 10:36 am, edited 1 time in total.
User avatar
Peristeri Center
Posts: 9
Joined: Sun 31 May 2009 12:03 pm
Weather Station: TFA Matrix II 3510.49
Operating System: Peppermint OS 8 (Linux).
Location: Athens-Peristeri GREECE
Contact:

Re: Wouldnt It Be Handy If.......... .PHP

Post by Peristeri Center »

Good evening from Athens

Thank you for your work, i have find it toooooo.....helpfull.

BTW who will write a wiki for betel_ajax project ? I mean file structure in server, basic file's config. etc.

One more time thank you and of course STEVE !!!
6719jason
Posts: 519
Joined: Wed 08 Apr 2009 12:38 pm
Weather Station: La-Crosse WS3502
Operating System: Windows 7
Location: Holland On Sea, Essex UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by 6719jason »

Good Evening All,

Just a quick post,

For those of you who use the standard Cumulus template, I have created a Special 'Status' page for you.

Example http://www.weeleyweatherstation.info/status.htm

It is included in a package of Standard Web Templates for Cumulus, all of which include a link to this 'Status' page.

Please ensure that you manually add the 'StatusT.htm' to be processed and ftp by Cumulus.

Also ensure you manually upload 'Status' & StatusT' to your webserver.

Also ensure your 'RecentUpload.php' is within the same directory as 'Status & StatusT'.

If it is not, you will have to manually edit the path, within the 'StatusT.htm' file.

Jason
You do not have the required permissions to view the files attached to this post.
6719jason
Posts: 519
Joined: Wed 08 Apr 2009 12:38 pm
Weather Station: La-Crosse WS3502
Operating System: Windows 7
Location: Holland On Sea, Essex UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by 6719jason »

Good Evening All,

Another Quick Updated Version.

Now on Version 1.3 - Tweaked 'Frequency' & Updated 'Ajax' code.(Thankyou Betel_Juice) :)

All instructions and code included.

Jason
You do not have the required permissions to view the files attached to this post.
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: Wouldnt It Be Handy If.......... .PHP

Post by n9mfk »

Hi Jason,
I not sure what i did wrong in the reload script
here the error i get
url is not defined
file_data("http://www.n9mfk.com/recentupload.php?1253123594138")update.php (line 33)
update.php()update.php (line 60)
[Break on this error] var xx = (window.ActiveXObject) ? ne...ft.XMLHTTP") : new XMLHttpRequest(url);\nupdate.php (line 33)
here the page http://www.n9mfk.com/update.php
thanks Beau
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by beteljuice »

Seems to be working atm (top left hand corner).

You seem to have some 'hard' html in your 'content' <div>, and 'the_content' <div> should be inside that one.

You have the ajax loop set to 3000 (3s), but that is also the ftp time of your realtime.txt, so it looks like the 'time since' count never changes ;)
Image
......................Imagine, what you will KNOW tomorrow !
Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

Re: Wouldnt It Be Handy If.......... .PHP

Post by Synewave »

Jason and Betel,

I've just installed this and it is great, very useful thanks.

It's really helping as I've been suffering with FTP upload failures, and this will help to identify patterns.

Thanks again,
The it guy
Posts: 29
Joined: Fri 22 Feb 2019 12:46 am
Weather Station: Davis
Operating System: Windows 10

Re: Wouldnt It Be Handy If.......... .PHP

Post by The it guy »

hi all sorry for bringing up a old one here but im on php 7.3 and this is saying about


should using time and i have done that and now it giving me this error

PHP Warning: time() expects exactly 0 parameters, 6 given
function timediff ($filepath) {
//Get time stamp of file
$t = date("mdyHis", filectime($filepath));
//Split $t into month, day, and year values
$m = substr($t, 0, 2);
$d = substr($t, 2, 2);
$y = substr($t, 4, 2);
$h = substr($t, 6, 2);
$min = substr($t, 8, 2);
$s = substr($t, 10, 2);
$timestamp = time($h, $min, $s, $m, $d, $y);
$tdiff = time() - $timestamp; //Subtrack $timestamp from now, give us diff in seconds.
//Determin how to display by size of timediff
if ($tdiff < 60) {
//Timediff is less then 1 minute, so must be seconds
$tdiff=number_format($tdiff);
return $tdiff." sec";
} elseif ($tdiff < 3600) {
//timediff is less then 1 hour, so must be minutes
$tdiff=$tdiff/60;
$tdiff=number_format($tdiff, 1, '.', '');
return $tdiff." min";
} elseif ($tdiff < 216000) {
//timediff is less then 1 day, so must be hours.
$tdiff=($tdiff/60)/60;
$tdiff=number_format($tdiff, 1, '.', '');
return $tdiff." hr";
} else {
//timediff is greater then 1 day, so must be days.
$tdiff=(($tdiff/60)/60)/24;
$tdiff=number_format($tdiff, 1, '.', '');
return $tdiff." days";
}
}
?>
any help will be great as like to keep logs clean :P
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by beteljuice »

mktime() is valid across all versions of PHP

" ... should using time " - what else did it say, and did the code actually fail ?
Image
......................Imagine, what you will KNOW tomorrow !
The it guy
Posts: 29
Joined: Fri 22 Feb 2019 12:46 am
Weather Station: Davis
Operating System: Windows 10

Re: Wouldnt It Be Handy If.......... .PHP

Post by The it guy »

the code run fine with out fail but it filling up my logs very fast

and the rest off the error

is [10-Jun-2021 16:44:16 Europe/London] PHP Deprecated: mktime(): You should be using the time() function instead in /recentupload.php on line 62




and the code on line 62 is

$tdiff = mktime() - $timestamp; //Subtrack $timestamp from now, give us diff in seconds.

Code: Select all

<?PHP date_default_timezone_set("Europe/London");?> <!--Change to your time zone, see scripts website for help identifying your timezone-->
</b><br/>
<table data-table-theme="dark stripes" style="width:100%;border-collapse: collapse; border-spacing: 0;">


<th>Uploaded File<th>Upload Frequency<th>Last Upload<th>Time Since Last Upload
	<!--Change the path to the file from ./realtime.txt to a file you want to monitor. Do this 3 times per line. Change the frequency to the time it takes for the file to upload (example text: 1 minute) Repeat for each of the lines below. -->
<tr>
    <td>Cumulus realtime.txt<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./realtime.txt")); ?><td align=center><?PHP echo timediff("./realtime.txt");?>
<tr>
    <td>Realtime Gauges<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./realtimegauges.txt")); ?><td align=center><?PHP echo timediff("./realtimegauges.txt");?>
<tr>
    <td>IP Camera Weather Data<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./camdata.txt")); ?><td align=center><?PHP echo timediff("./camdata.txt");?>  
<tr>
    <td>IP Camera Image<td align=center>Every 5mins<td><?PHP echo date("m/d/y H:i:s T", filectime("./images/webcam.jpg")); ?><td align=center><?PHP echo timediff("./images/webcam.jpg");?>  
<tr>
    <td>Moon Image<td align=center>Every 1 Hour<td><?PHP echo date("m/d/y H:i:s T", filectime("./images/moon.png")); ?><td align=center><?PHP echo timediff("./images/moon.png");?>
<tr>
    <td>Weather Station Android App <td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./realtime.xml")); ?><td align=center><?PHP echo timediff("./realtime.xml");?>
<tr>
    <td>Sparkline Little Charts<td align=center>Every 5mins<td><?PHP echo date("m/d/y H:i:s T", filectime("./sparkline_tags.php")); ?><td align=center><?PHP echo timediff("./sparkline_tags.php");?>
<tr>
    <td>Smb_Ajax Flash Up Date<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./cumulus.xml")); ?><td align=center><?PHP echo timediff("./cumulus.xml");?>
<tr>
    <td>Custom_Realtime<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./custom_realtime.txt")); ?><td align=center><?PHP echo timediff("./custom_realtime.txt");?>    
<tr>
    <td>Davis Vantage VP2 Console<td align=center>Every 5mins<td><?PHP echo date("m/d/y H:i:s T", filectime("./davcon24.txt")); ?><td align=center><?PHP echo timediff("./davcon24.txt");?>
<tr>
    <td>Current Conditions Bar<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./CCdata.php")); ?><td align=center><?PHP echo timediff("./CCdata.php");?>
<tr>
    <td>Cumulusweb Tags<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./cumuluswebtags.php")); ?><td align=center><?PHP echo timediff("./cumuluswebtags.php");?>
<tr>
    <td>GW-1000 Webtags<td align=center>4 Seconds<td><?PHP echo date("m/d/y H:i:s T", filectime("./GW-1000tags.php")); ?><td align=center><?PHP echo timediff("./GW-1000tags.php");?>
</table>

<?PHP 
//==========================================================================
//  Function timediff - Jason Duncombe - Weeley Weather Station UK
//  //  version: 1.0 - 19/08/09 - Public Released version
//  Description: This function calculates the number of seconds, minutes,
//  hours, or days since the file's timestamp has been written. This works
//  well for files uploaded to your website via FTP, since the timestamp
//  reflects when the file was last written to the server with your FTP client.
//==========================================================================
function timediff ($filepath) {
	//Get time stamp of file
	$t = date("mdyHis", filectime($filepath));
	//Split $t into month, day, and year values
	$m = substr($t, 0, 2);
	$d = substr($t, 2, 2);
	$y = substr($t, 4, 2);
	$h = substr($t, 6, 2);
	$min = substr($t, 8, 2);
	$s = substr($t, 10, 2);
	$timestamp = mktime($h, $min, $s, $m, $d, $y);
	$tdiff = mktime() - $timestamp; //Subtrack $timestamp from now, give us diff in seconds.
	//Determin how to display by size of timediff
	if ($tdiff < 60) { 
		//Timediff is less then 1 minute, so must be seconds
		$tdiff=number_format($tdiff);
		return $tdiff." sec";
	} elseif ($tdiff < 3600) { 
		//timediff is less then 1 hour, so must be minutes
		$tdiff=$tdiff/60;
		$tdiff=number_format($tdiff, 1, '.', '');
		return $tdiff." min";
	} elseif ($tdiff < 216000) { 
		//timediff is less then 1 day, so must be hours.
		$tdiff=($tdiff/60)/60;
		$tdiff=number_format($tdiff, 1, '.', '');
		return $tdiff." hr";
	} else { 
		//timediff is greater then 1 day, so must be days.
		$tdiff=(($tdiff/60)/60)/24;
		$tdiff=number_format($tdiff, 1, '.', '');
		return $tdiff." days";
	}
}
?>
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Wouldnt It Be Handy If.......... .PHP

Post by beteljuice »

Ahh ...

OK php 7.3 was a slightly cranky version, and its not really an error but an advisory.

Change just ...

Code: Select all

$tdiff = mktime() - $timestamp; //Subtrack $timestamp from now, give us diff in seconds.
to:

Code: Select all

$tdiff = time() - $timestamp; //Subtrack $timestamp from now, give us diff in seconds.
... and hopefully you won't get a log jam :)
Image
......................Imagine, what you will KNOW tomorrow !
Post Reply