<?php
/* Line Counter - by dark2k1(dark2k1.com) */
function form() {
global $lines_all;
?>
<form action="line_counter.php?func=count_lines" method="post">
<input type="file" name="file">
<input type="hidden" name="lines_all" value="<? echo $lines_all; ?>">
<input type="submit">
</form>
<?
}
function count_lines() {
global $file, $lines_all;
$line = "0";
if ($fh = fopen($file,'r')) {
while (! feof($fh)) {
if (fgets($fh,1048576)){
$lines++;
}
}
}
echo "$lines<br>
$file<br>";
$lines_all += $lines;
echo $lines_all;
echo "<br><a href='line_counter.php?lines_all=$lines_all'>Another?</a>";
form();
}
switch($func) {
default;
form();
break;
case "count_lines";
count_lines();
break;
}
?>