home.jpghome01.jpghome02.jpghome03.jpghome04.jpghome05.jpghome06.jpghome07.jpghome08.jpghome09.jpghome10.jpghome11.jpghome12.jpghome13.jpghome14.jpghome15.jpghome16.jpghome17.jpghome18.jpghome19.jpg
Benvenuto, Ospite
Nome utente: Password: Ricordami
  • Pagina:
  • 1

ARGOMENTO: Script Telecamera

Script Telecamera 12 Anni 7 Mesi fa #8

  • admin
  • Avatar di admin
  • OFFLINE
  • Administrator
  • Messaggi: 5
  • Karma: 0
Per tutti coloro che utilizzano telecamere che pubblicano le immagini su un ftp con nome diverso ogni foto, lo script utilizzato in questo sito è il seguente, sviluppato da me:

Caratteristiche: Refresh pagina ogni 20 min; cancellazione delle foto con data risalente al giorno prima e pubblicazione del timestamp della foto visualizzata

<?php
//nuovo script

$arrayfile = Array();
function ordina($file1,$file2)
{
$tempo1 = ($file1);
$tempo2 = ($file2);
return ($tempo1 < $tempo2) ? 1 : -1;
}
if ($handle = opendir('foto/'))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..") {
$arrayfile[]=$file;
}
}
closedir($handle);
usort($arrayfile,'ordina');
}

?>

<?php

//Cancella File

// setup timezone and get timestamp for yesterday
date_default_timezone_set('Europe/Athens'); // change to yours
$yesterday = strtotime('-1 day', time());
// setup path to cache dir and initialize iterator
$path = realpath('foto/'); // change to yours
$objects = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path));
// iterate over files in directory and delete them
foreach($objects as $name => $object){
if ($object->isFile() && ($object->getCTime() < $yesterday)) {
unlink($object);
//echo PHP_EOL, 'deleted ' . $object;
}
}
?>

<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kioni.net</title>
<script>
<!--
//Refresh Automatico della Pagina
//enter refresh time in "minutes:seconds". Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="21:00"

if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}

window.onload=beginrefresh
//-->
</script>

</head>

<body>

<p align="center"><img src="foto/<?php echo $arrayfile[0]; ?>" ></p>

<?php
// variabile che prende l'informazione.
$last_time_modified = filemtime("foto/$arrayfile[0]");
// formatta la data
$last_mod = "Foto del " . date("j/m/Y h:i:s A e", $last_time_modified);
print $last_mod;
?>

</font>
</p>
<p align="center"><font face="Verdana">Refresh automatico ogni 20 minuti.</font>
</p>

</body>
</html>

Cordiali saluti a tutti i webmaster!
Mattia480
Amministratore Kioni.net - Questo indirizzo email è protetto dagli spambots. E' necessario abilitare JavaScript per vederlo.
Ultima modifica: 12 Anni 4 Mesi fa da admin.
L\'Amministratore ha disattivato l\'accesso in scrittura al pubblico.
  • Pagina:
  • 1
Tempo creazione pagina: 0.173 secondi