Сорцы

motion.pub:


#!/bin/bash
prefile="aaa"
while true; do
fname=`ls /var/motion|tail -n2|head -n 1`
if [ $fname"a" != "a" ]; then
    if [ $fname != $prefile ]; then
        prefile=$fname
        echo $fname
        cp /var/motion/$fname /var/www/html/output.jpg_
        mv /var/www/html/output.jpg_ /var/www/html/output.jpg
    fi
fi
c_count=`ls /var/motion | wc -l`
if [ $c_count -gt 100 ]; then
    rm -f `ls /var/motion/*.jpg|head -n 90`
fi
done

index.php:


<?php
function send_file($name,$ctype) {
    ob_end_clean();
    $path = "".$name;
    if (!is_file($path) or connection_status()!=0) return(FALSE);
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
//    header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
    header("Refresh: 1; http://investhmao.ru/kaff/");
    header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
    header("Content-Type: ".$ctype);
    header("Content-Length: ".(string)(filesize($path)));
    header("Content-Disposition: inline; filename=$name");
    header("Content-Transfer-Encoding: binary\n");
    if ($file = fopen($path, 'rb')) {
    while(!feof($file) and (connection_status()==0)) {
            print(fread($file, 1024*8));
            flush();
        }
        fclose($file);
    }
    return((connection_status()==0) and !connection_aborted());
}
send_file("output.jpg","image/jpeg");
?>

my7.module:


<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs title="My fishes" height="250" scaling="false" />
    <Content type="html">
  <![CDATA[

<span id="imgnum" ></span>
<img id="camimg1" src="http://investhmao.ru/kaff/">
<img id="camimg2" src="" style="display: none;">
    <script language="javascript">
var imgnum=0;
var tm1=null;
var tm2=null;
document.getElementById("camimg1").onload=function(e){
    if(tm1!=null){
    clearTimeout(tm1);
    tm1=null;
    }
    document.getElementById("imgnum").innerHTML=imgnum;
    document.getElementById("camimg1").style.display="block";
    document.getElementById("camimg2").style.display="none";
    to2();
}
document.getElementById("camimg2").onload=function(e){
    if(tm2!=null){
    clearTimeout(tm2);
    tm2=null;
    }
    document.getElementById("imgnum").innerHTML=imgnum;
    document.getElementById("camimg2").myvar=e;
    document.getElementById("camimg2").style.display="block";
    document.getElementById("camimg1").style.display="none";
    to1();
}
function to2(){
    tm2=setTimeout('timeout2()',20000);
    document.getElementById("camimg2").src="http://investhmao.ru/kaff/?r="+imgnum;
    imgnum++
}
function to1(){
    tm1=setTimeout('timeout1()',20000);
    document.getElementById("camimg1").src="http://investhmao.ru/kaff/?r="+imgnum;
    imgnum++;
}
function timeout1(){
    to1();
}
function timeout2(){
    to2();
}
document.getElementById("camimg1").src="http://investhmao.ru/kaff/?r="+Math.random();
</script>
    ]]>
  </Content>
</Module>
Comments