Cofirm-Code

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Cofirm-Code

    Hi,
    bin gerade am Homepagebasteln... Wollte natürlich auch ein Gästebuch reinbringen, nur leider kriege ich das mit dem Bestätigungscode nicht hin...
    Kann zwar super das Bild erstellen, aber wie krieg ich das hin, dass ich es in die index includen kann o.O? Der will ja den header...
    Hier ist die Bilddatei:

    PHP-Code:
    <?
    $pool = "qwertzupasdfghkyxcvbnm";
    $pool .= "23456789";
    $pool .= "WERTZUPLKJHGFDSAYXCVBNM";
    srand ((double)microtime()*1000000);
    for($index = 0; $index < 5; $index++)
    {
    $codes .= substr($pool,(rand()%(strlen ($pool))), 1);
    }
    $code = strtolower(trim($codes));
    $font = $_SERVER['DOCUMENT_ROOT']."/fonts/visit.ttf";
    $width = 70;
    $height = 30;
    $img = ImageCreate($width, $height);
    $white = ImageColorAllocate($img, 255, 255, 255);
    $black = ImageColorAllocate($img, 0, 0, 0);
    $s1 = ImageColorAllocate($img, 122, 209, 155);
    $s2 = ImageColorAllocate($img, 211, 202, 111);
    $s3 = ImageColorAllocate($img, 011, 102, 111);
    Header("Content-Type: image/png");
    ImageFill ($img, 0, 0, $white);
    ImageLine($img, 13, 0, 20, 19, $s1);
    ImageLine($img, 0, 13, 250, 15, $s2);
    ImageLine($img, 10, 5, 55, 10, $s3);
    ImageTTFText ($img, 20, 0, 5, 20, $black, $font, $code);
    ImagePNG($img);
    ImageDestroy($img);
    mysql_query("insert into code(code, ip, host, datum, uhrzeit, time)
    values('$code','$ip','$host','$datum','$uhrzeit','$time')");

    ?>
    Will einfach nur das erstellte Bild in die index importieren, hab ihr eine Idee??

  • #2
    index.php
    Code:
    <img src="bild.php" alt="Code eingeben">
    bild.php
    PHP-Code:
     ...
    Header("Content-Type: image/png");
    ...
    ImagePNG($img);
    ... 
    Die Regeln | rtfm | register_globals | strings | SQL-Injections | [COLOR=silver][[/COLOR][COLOR=royalblue]–[/COLOR][COLOR=silver]][/COLOR]

    Kommentar


    • #3
      Danke,
      bin ich auch nicht drauf gekommen ^^
      funktioniert super!

      Thx

      Kommentar

      Lädt...
      X