index.php Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Last-Modified" content="0">
<meta http-equiv="Cache-Control" content="no-cache, mustrevalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Campo eléctrico en MEXART Coeneo</title>
<link rel="stylesheet" type="text/css" href="mi_css.css" />
<link rel="stylesheet" type="text/css" href="botones/buttons.css" />
<link rel="stylesheet" type="text/css" href="botones/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="botones/font-awesome-ie7.min.css" />
<script type="text/javascript" src="mi_js.js"></script>
</head>
<body onload="recarga()">
<div></div>
<div class="hoja">
<h1 align="center">
Monitor de Campo Eléctrico
</h1>
<div class="contizq">
<div class="grafica" id="contenedor"></div>
<div class="final"></div>
</div>
<div class="cotder">
<div class="muestras">muestras <br />
<textarea class="test" name="testo" cols="17" rows="25" readonly="readonly">
<?php
$file = fopen("muestras.txt", "r") or exit("Unable to open file!");
while(!feof($file)){
echo fgets($file)."";
}
fclose($file);
?>
</textarea>
<div class="sub">Muestras.txt <br />Creacion =
<?php echo date('h:i:s',fileatime("muestras.txt")) ?>
</div>
<a class="button button-pill" href="descarga.php?archivo=muestras.txt" target="new">Descargar</a>
</div>
<div class="muestrasaltas">
M. Altas<br />
<textarea class="testa" name="testoa" cols="17" rows="25" readonly="readonly">
<?php
$file = fopen("h-muestras.txt", "r") or exit("Unable to open file!");
while(!feof($file)){
echo fgets($file)."";
}
fclose($file);
?>
</textarea>
<a class="button button-pill" href="descarga.php?archivo=h-muestras.txt" target="new">Descargar</a>
</div>
<div class="muestrasmaltas">
M. muy altas <br />
<textarea class="testma" name="testoma" cols="17" rows="25" readonly="readonly">
<?php
$file = fopen("vh-muestras.txt", "r") or exit("Unable to open file!");
while(!feof($file)){
echo fgets($file)."";
}
fclose($file);
?>
</textarea>
<a class="button button-pill" href="descarga.php?archivo=vh-muestras.txt" target="new">Descargar</a>
</div>
<div class="final"></div>
</div>
<div class="final" ></div>
</div>
</body>
</html>
mi_css.css Código HTML:
/* CSS Document */
body{background-color:#999999;}
.hoja{background-color:#e6aa28; width: 95%; margin:auto; margin-top:10px; padding:20px;}
.final{clear:both; margin:20px; padding:20px;}
h1{background:#0f244b; padding:8px; margin-top:5px; color:#FFF; border-radius:10px;}
.grafica{}
.datos{ width:45%; border:#000 solid 1px; float:right;}
.leyenda{float:none;}
.contizq{float:left; width:46%; border:#000 solid 1px; padding:7px; background:#FFF;}
.cotder{float:right; width:46%; text-align:center;}
.muestras{ width: 31%; border: solid 1px; float:left; margin-left:2px; background:#FFF; font-weight:bold; color:#060;}
.muestrasaltas{ width:31%; border: solid 1px; float: left; margin:auto; margin-left:2px; margin-right:2px; background:#FFF; font-weight:bold; color:#C90;}
.muestrasmaltas{ width: 31%; border:solid 1px; float:left; margin:auto; background:#FFF; font-weight:bold; color:#F00;}
.test{color:#0C0; font-weight:bold; font-weight:bold;}
.testa{color:#FC0; font-weight:bold; font-weight:bold;}
.testma{color:#F00; font-weight:bold; font-weight:bold;}
.sub{ font-size:12px; color:#666;}
mi_js.js Código HTML:
// JavaScript Document
var ajax=XMLHttp();
function XMLHttp(){
var Object;
if (typeof XMLHttpRequest == "undefined" ){
if(navigator.userAgent.indexOf("MSIE 5") >= 0){
Object= new ActiveXObject("Microsoft.XMLHTTP");
}else{
Object=new ActiveXObject("Msxml2.XMLHTTP");
}
}else{
Object=new XMLHttpRequest();}
return Object;
}
function recarga(){
if(ajax){
cont=document.getElementById('contenedor');
ajax.open("GET","imagen.php?refrescar=" + Math.random(),true);
//ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded","");
ajax.onreadystatechange=function(){
if(ajax.readyState==4){
var valor=ajax.responseText;
cont.innerHTML=valor;
}else{
cont.innerHTML="<img src='loading.gif' />";
}
}
ajax.send(null);
}//end ajax
}
setInterval("recarga()",10000);
imagen.php Código PHP:
<img src="muestras.jpg" width="90%" height="100%" />