/media/sda-magnetic/david/Extern-Magnetic-2022-06-29/Extern01/Dokumente-2021-05-8/disk10-ab-2020-01-10/02-debian-pc2-work/informatik/php-graphix-2021-03-04/test2/traceroute-graphics.php


        <?php
        session_start ();

        $flag = true;
        $max = 0;
        $count = array ();
        for ($i = 0;  $i < 11;  $i++) {
            $a = explode ("\n", $_SESSION [$i . "x"]); 
            $count [$i] = count ($a) - 2;
            echo $count [$i];
            echo $_SESSION [$i];
            if ($count [$i] > $max)
                $max = $count [$i];
        }

        if ($flag) {
            $myImage = imagecreate(330, $max*10+$count [0]*10);
        
            $myGray = imagecolorallocate($myImage, 204, 204, 204);
            $myRed = imagecolorallocate($myImage, 200, 40, 40);
            $myBlue = imagecolorallocate($myImage, 20, 240, 20);
        
        
            $old_x = 0;
            $old_y = 0;
            $x = 0;
            $y = 0;
            for ($i = 0;  $i < 11;   $i++) {
                $x += 30;
                $y = $count [$i] * 5;
                imageline ($myImage, $old_x, ($max*10) - $old_y, $x, ($max*10)-$y, $myRed);
                imageline ($myImage, $x, 0, $x, $max*10, $myBlue);
                $old_x = $x;
                $old_y = $y;
        
            }
        
            ob_start();
            imagepng($myImage);
            printf('<img src="data:image/png;base64,%s"/>', 
            base64_encode(ob_get_clean()));

            imagedestroy($myImage);
        }
        else
            echo "one of the given url's is not known";
        ?>