Cześć,
Mam problem jak zrobić żeby skrypt który wykonuje się ~30 min przekazywał do przeglądarki dane o postępie prac?
mam w nim skrypt który powinien dotrzeć do przeglądarki w trakcie wykonywania, oraz jeden na samym początku.
Wygląda to tak:
<?php //WYSYŁANE PRZED WYKONANIEM ->
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Kontrola</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type='text/javascript'>
skrypt
</script>
</head><body OnLoad="timerStart();">
<h2>Czas działania:<b id='time_counter'></b></h2>
<table border="1" width="400px" height="30"><tr><td id="postep" width="2px" bgcolor="green">
</td><td></td></tr></table>
<?
function Clen($document){
$search = array('@<script[^>]*?'.'>.*?</script>@si', // Strip out javascript '@<head[^>]*?'.'>.*?</head>@si', //<head>
'@<div class="navigation">.*?<ol>.*?</ol>.*?</div>@si', //menu
'@<div class="tab1 page">.*?<div class="row headline">@si',
'@<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">.*?<div class="margin" style="width:430px;">@si',
'@<!-- .box-content -->.*?</html>@si',
'@<!-- tabOverview.ftl -->.*?</div><!-- .col -->@si',
'@<div class="feature-pairs">.*?@si',
'@<body class="des pl des_pl ">.*?<!-- d-59-destext -->@si',
'@<div id="contactFormDiv1">.*?<!-- /bottomContactForm -->@si',
// '@<style[^>]*?'.'>.*?</style>@siU', // Strip style tags properly
// '@<[/!]*?[^<>]*?'.'>@si', // Strip out HTML tags
'@<![sS]*?--[ tnr]*>@', // Strip multi-line comments including CDATA
'@\n@si',
'@<div class="infoBoxContent ">.*?</div>@si',
'@<a title="Informacje"^.*?@si',
);
return $datat;
}
$server = "#";
$user = "#";
$pwd = "#";
if (!$link) {
}
if (!$db_selected) {
}
$i = 0;
$i++;
$url = NULL;
$cena = NULL;
$strona3 = NULL;
$urls = NULL;
$cena = $row['a2'];
$url = $row['add'];
include ('downpage.php');
$urls= ''.$row['link'].'';
if ($fo = @fopen($urls,'r')) { if ($strona3 != $cena)
{ $d = 2; } else {$d = 1;}
} elseif ($pt == TRUE) {$d = 3;}
else {$d = 4;}
} else { $d = 0;}
$pasek = 400 / $i * 100;
/*#####wysyłane w trakcie informując o postępie prac#########*/
echo $d.'<div onLoad="postep.setAttribute("width","'.$pasek.'");" style="display:none;"></div>'; /*##########################################################*/
$server = "#";
$user = "#";
$pwd = "#";
if (!$link) {
}
if (!$db_selected) {
}
$query = mysql_query("UPDATE # SET status='".$d."' WHERE id='".$row['id']."'");mysql_close
(); }
?>
<body OnLoad="timerStop();"></html>