Example #1
0
# -----------------------------------------------------------
# 14/08/05	initial version.
*/
$bg1 = "884488";
$bg2 = "CC88CC";
$cmd = isset($_GET['cmd']) ? $_GET['cmd'] : '';
$res = isset($_GET['res']) ? $_GET['res'] : 'vga';
$xf = isset($_GET['xf']) ? $_GET['xf'] : 4;
$yf = isset($_GET['yf']) ? $_GET['yf'] : 4;
$xt = isset($_GET['xt']) ? $_GET['xt'] : 4;
$yt = isset($_GET['yt']) ? $_GET['yt'] : 4;
$f = isset($_GET['function']) ? $_GET['function'] : 'sin(30 * $x) * 1 / cos($x) / $x';
#	$f='tan($x - $x * cos(pi() * $x))';
if ($cmd == "img") {
    include_once "inc/graph.php";
    $graph = new FunctionGraph($xf, $yf);
    $graph->drawAxes();
    $graph->drawFunction($_GET['function'], 0.01);
    $graph->writePNG();
    $graph->destroy();
    die;
}
include_once "inc/header.php";
$_GET = sanitize($_GET);
# Can't sanitize before including header (which breakes png output)
?>
<h1>Other Plot</h1>
<form method="get" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
Example #2
0
<?php

# Program: Other-Plot.php
# Programmer: Remo Rickli
$cmd = isset($_GET['cmd']) ? $_GET['cmd'] : '';
$res = isset($_GET['res']) ? $_GET['res'] : 'vga';
$xf = isset($_GET['xf']) ? $_GET['xf'] : 4;
$yf = isset($_GET['yf']) ? $_GET['yf'] : 4;
$xt = isset($_GET['xt']) ? $_GET['xt'] : 4;
$yt = isset($_GET['yt']) ? $_GET['yt'] : 4;
$f = isset($_GET['function']) ? $_GET['function'] : 'sin(30 * $x) * 1 / cos($x) / $x';
#	$f='tan($x - $x * cos(pi() * $x))';
if ($cmd == "img") {
    include_once "inc/graph.php";
    $graph = new FunctionGraph($xf, $yf);
    $graph->drawAxes();
    $graph->drawFunction($f, 0.01);
    $graph->writePNG();
    $graph->destroy();
    die;
}
include_once "inc/header.php";
$_GET = sanitize($_GET);
# Can't sanitize before including header (which breakes png output)
?>
<h1>Other Plot</h1>
<form method="get" action="<?php 
echo $self;
?>
.php">
<table class="content" ><tr class="<?php