Location: PHPKode > projects > PHP Cad and Drawing Program > setup.php
<?php
session_start();
$pfilez=$_SESSION[pfilez];
//loads current .setup file for the .tob
$ff = str_replace(".tob",".setup",$pfilez);
if (file_exists("./files/$ff")) {
    include("./files/$ff");
} else {
    include("./files/picture.setup");
}


// Catches Form Being Sent ****************
if ($_GET[formsent] == "nochange") {
    header("Location: index.php");
}

if ($_GET[formsent]=="drawpic") {
    header("Location: drawimage.php");
}

if ($_GET[formsent]=="drawgif") {
    header("Location: test.gif");
}


if ($_GET[formsent]=="sent") {

$a=64;
$b=48;
$scale=10;
$style=1;
$a=$_GET[pa];
$b=$_GET[pb];
$scale=$_GET[pscale];

if ($a>200) $a=200;
if ($a<8) $a=8;
if ($b>200) $b=200;
if ($b<8) $b=8;
if ($scale<1) $scale=1;
if ($scale>30) $scale=10;

if( $_GET[pcolor]=="Color Scheme Padobe") $style=1;
if( $_GET[pcolor]=="Color Scheme Ruby") $style=2;
if( $_GET[pcolor]=="Color Scheme Green") $style=3;
if( $_GET[pcolor]=="Color Scheme Burgundy") $style=4;
if( $_GET[pcolor]=="Color Scheme Wood Yellow") $style=5;
if( $_GET[pcolor]=="Color Scheme Blue") $style=6;
if( $_GET[pcolor]=="Color Scheme Black on White") $style=7;
$zz=fopen("./files/$ff","w");
$item ="<?php\n";
fwrite($zz,$item);
$item ="$" . "a=" . $a . ";\n";
fwrite($zz,$item);
$item ="$" . "b=" . $b . ";\n";
fwrite($zz,$item);
$item ="$" . "style=" . $style . ";\n";
fwrite($zz,$item);
$item ="$" . "gridon=" . $_GET[pgridon] . ";\n";
fwrite($zz,$item);
$item ="$" . "scale=" . $scale . ";\n";
fwrite($zz,$item);
$item ="$" . "imageformat=" . $_GET[pif] . ";\n";
fwrite($zz,$item);
$item ="$" . "imagequality=" . $_GET[piq] . ";\n";
fwrite($zz,$item);
$item ="?>\n";
fwrite($zz,$item);
fclose($zz);
header("Location: index.php");
}
// End of Form Catches


// Start of Form
echo "<html>\n";
echo "<body bgcolor='A2A2A2' link='000000' vlink='000000' alink='000000'>\n";
echo "<BR>\n";


echo "<b>$ff</b><BR>\n";

echo "<table border='1' cellpadding=2 cellspacing=0><tr></tr>\n";
echo "<tr><td width=200>Scale-Width(a)-Height(b)</td><td>";

echo "<form name='second' method='GET' action='$PHP_SELF'>\n";

$aa="<select name='PObj' onChange='redirect(this.options.selectedIndex)'>
<option>CGA 320-200 scale 10</option>
<option>VGA 640-480 scale 10</option>
<option>SVGA 800-600 scale 10</option>
<option>XGA 1024-768 scale 8</option>
<option>DVD 720-480 scale 10</option>
<option>VCD 352-240 scale 8</option>
<option>BANNER ADS 468-60 scale 6</option>
<option>BANNER ADS 468-60 scale 3</option>
<option>PAYPAL 150-50 scale 5</option>
<option>PAPER 850-1100 scale 10</option>
<option>EBAY FREE 400-300 scale 10</option>
<option>LARGE BUTTON 125-125 scale 5</option>
<option>MEDIUM BUTTON 120-90 scale 3</option>
<option>SMALL BUTTON 120-60 scale 3</option>
<option>SKYSCRAPER 120-600 scale 5</option>
<option>SKYSCRAPER 160-600 scale 5</option>
<option>FAVICON 8-8 scale 1</option>
<option>ICON 16-16 scale 1</option>
<option>ICON 32-32 scale 1</option>
</select><br>
    scale=<input type=text name='pscale' value='$scale' size=4>
    a=<input type=text name='pa' value='$a' size=5>
    b=<input type=text name='pb' value='$b' size=5>";
echo $aa;

echo "</td></tr>\n";

echo "<tr><td>Grid Sytle (0-off, 1-on, 2-style)</td><td>";
$glist= array("0","1","2","3");
echo "<select name='pgridon' value='$gridon'>\n";
foreach($glist as $items) echo "<option>" . $items . "</option>\n";
echo "</select>\n";
echo "</td></tr>\n";

echo "<tr><td>Grid and Background Colors</td><td>";
$qlist= array(
"Color Scheme Padobe",
"Color Scheme Ruby",
"Color Scheme Green",
"Color Scheme Burgundy",
"Color Scheme Wood Yellow",
"Color Scheme Blue",
"Color Scheme Black on White");
echo "<select name='pcolor'>\n";
foreach($qlist as $items) echo "<option>" . $items . "</option>\n";
echo "</select>\n";
echo "</td></tr>\n";

echo "<tr><td>Picture Type (png is default)</td><td>";
$if= array("png","jpg");
echo "<select name='pif'>\n";
foreach($if as $items) echo "<option>" . $items . "</option>\n";
echo "</select>\n";
echo "</td></tr>\n";

echo "<tr><td>JPG Picture Quality</td><td>";
$iq= array("30","50","60","70","80","90","95","100");
echo "<select name='piq'>\n";
foreach($iq as $items) echo "<option>" . $items . "</option>\n";
echo "</select>\n";
echo "</td></tr>\n";

echo "<tr><td colspan=3>\n";
echo "<input  name='formsent' Type='hidden' value='sent'>\n";
echo "<input  name='pfilez' Type='hidden' value=$pfilez>\n";
echo "<input type='submit'></form>\n";
echo "</td></tr>";

echo "<tr><td colspan=3><form method='GET' action='$PHP_SELF'>\n";
echo "<input  name='formsent' Type='hidden' value='nochange'>\n";
echo "<input value='Return Without Changing' type='submit'></form>\n";
echo "</td></tr>";

echo "<tr><td colspan=3><form method='GET' action='$PHP_SELF'>\n";
echo "<input  name='formsent' Type='hidden' value='drawpic'>\n";
echo "<input value='Draw PNG/JPG - right click on picture to save!'";
echo "type='submit'></form>\n";

echo "</td></tr></table>";
echo "</body></html>";
?>

<script>
/*
Second Form Script Credit
Originally by JavaScript Kit (www.javascriptkit.com)
*/


var pscale=new Array("10","10","10","8","10","8","6","3","5","10",
                     "10","5","3","3","5","5","1","1","1")

var pa=new Array("32","64","80","128","72","44","78","156","30","85",
                 "40","25","40","40","24","32","8","16","32")

var pb=new Array("20","48","60","96","48","30","10","20","10","110",
                 "30","25","30","20","120","120","8","16","32")

function redirect(x) {
    document.second.pscale.value=pscale[x]
    document.second.pa.value=pa[x]
    document.second.pb.value=pb[x]
}

</script>


Return current item: PHP Cad and Drawing Program