#!/usr/bin/perl
#
# created by Marlen Bredehoeft
# TUHH - Rechenzentrum
# 07-08-2000
#
use GD; # Perl Grafik-Modul einbinden
use CGI qw/:standard/; # Perl CGI-Modul einbinden
#
# Sicherheitsabfrage
#
$URL1="http://" . $ENV{'HTTP_HOST'} ."/~rztwww/Kurse/PHP/CGI-Perl/CGI-Perl_6.php";
$URL2="http://" . $ENV{'HTTP_HOST'} ."/~rztwww/Kurse/PHP/CGI-Perl/printVersion/CGI-Perl_6.php";
$URL3="https://" . $ENV{'HTTP_HOST'} ."/~rztwww/Kurse/PHP/CGI-Perl/CGI-Perl_6.php";
$URL4="https://" . $ENV{'HTTP_HOST'} ."/~rztwww/Kurse/PHP/CGI-Perl/printVersion/CGI-Perl_6.php";
if (! (($ENV{'HTTP_REFERER'} eq $URL1) || ($ENV{'HTTP_REFERER'} eq $URL2) ||
($ENV{'HTTP_REFERER'} eq $URL3) || ($ENV{'HTTP_REFERER'} eq $URL4) ) ) {
print "Content-type: text/html\n\n";
print "
Zugriff verweigert!
";
exit;
}
###########################################################################
$a=param('a'); # Request Parameter 'a' zuweisen
$b=param('b'); # Request Parameter 'b' zuweisen
print "Content-type: image/png\n\n"; #HTTP-Header ausgeben
$image1 = new GD::Image(100,100); #Neues Image erzeugen.
$black = $image1->colorAllocate(0,0,0); #Einige Farben definieren.
$red = $image1->colorAllocate(255,0,0);
$green = $image1->colorAllocate(0,255,0);
$blue = $image1->colorAllocate(0,0,255);
$image1->filledRectangle(0,0,99,99,$green); #grünes gefülltes Rechteck zeichnen.
$image1->rectangle(0,0,99,99,$black); #schwarzes Rechteck zeichnen (Rahmen)
$image1->arc(50,50,$a,$b,0,360,$blue); #blaues Oval zeichnen
$image1->fill(50,50,$red); #und mit Rot fuellen.
$image1->string(gdLargeFont,35,40,$ENV{'REMOTE_PORT'},$green); #REMOTE_PORT-Nummer ausgeben.
binmode STDOUT; #Binaer-Stream sicherstellen.
#
print $image1->png; #Image nach PNG umwandeln und über
#die Standardausgabe
#