Source of: dupe_h2.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>HPGL Output</title>
</head>
<body>

<?php

// duplicates hpgl patterns on the x axis

$x_limit  = round($_POST['x_limit']);
$x_spacing  = $_POST['x_spacing'];
$my_text = @file_get_contents($_FILES['my_text']['tmp_name']) ;
echo
"<pre>\nSP1;\n\n";
$my_text2 = explode ("\n", $my_text);
$xmax = $x_spacing;
$x_count = 0;
while (
$x_count < $x_limit) {
reset($my_text2);
while (!
is_null($key = key($my_text2) ) ) {
if (
preg_match ("/(p[ud])(-?\d+) (-?\d+)/i", $my_text2[$key], $match)) {
echo
$match[1]. ($match[2]+$xmax*$x_count). " " .$match[3].";\n";
}
next($my_text2);
}
$x_count = $x_count+1;
echo
"\n";
}
echo
"SP0;\n</pre>\n";
?>

</body>
</html>