Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: Kontaktformular mit Captcha funktioniert nicht

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #105 am: 21. Juli 2014, 20:47:31
    Hallo sandro22

    Also das was gesendet wird sind Bilddaten aber sie sind unvollständig.

    Du kannst  folgendes versuchen:
    in der  /inc/xtc_render_vvcode.inc.php Zeilen 90 –95

    Code: PHP  [Auswählen]
    if (function_exists('imagettftext')) {                  
            imagettftext($imgh, $size, $angle, 15+(36*$i) , 38, $fonts, $font, substr($code, $i, 1));  
    } else {                                            
      $tc = ImageColorAllocate ($imgh, 0, 0, 0); //Schriftfarbe - schwarz        
            ImageString($imgh, $size, 26+(36*$i),20, substr($code, $i, 1), $tc);  
      }

    ersetzen mit

    Code: PHP  [Auswählen]
    /*
    if (function_exists('imagettftext')) {                  
            imagettftext($imgh, $size, $angle, 15+(36*$i) , 38, $fonts, $font, substr($code, $i, 1));  
    } else {                                            
      $tc = ImageColorAllocate ($imgh, 0, 0, 0); //Schriftfarbe - schwarz        
            ImageString($imgh, $size, 26+(36*$i),20, substr($code, $i, 1), $tc);  
      }
    */

    wenn dann ein Bild erscheint folgende Zeile danach einfügen

    Code: PHP  [Auswählen]
    ImageString($imgh, $size, 26+(36*$i),20, substr($code, $i, 1), ImageColorAllocate ($imgh, 0, 0, 0));

    Es handelt sich hier nur um einen Test.

    Gruss
    Hanspeter

    sandro22

    • Viel Schreiber
    • Beiträge: 589
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #106 am: 21. Juli 2014, 21:05:36
    hpzeller

    wen ich das mache wird immer noch nichts angezeigt.

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #107 am: 21. Juli 2014, 21:44:14
    hpzeller

    wen ich das mache wird immer noch nichts angezeigt.

    Dann alles zurück

    Nächster Vorschlag:
    ersetze in “display_vvcodes.php” alles zwischen “<?php” und ”?>” mit folgendem Code

    Code: PHP  [Auswählen]
    /* -----------------------------------------------------------------------------------------
      $Id: display_vvcodes.php 831 2005-03-13 10:16:09Z mz $  

       Copyright (c) 2004 XT-Commerce
       -----------------------------------------------------------------------------------------
     
       Released under the GNU General Public License  
       ---------------------------------------------------------------------------------------*/


    function xtc_rand($min = null, $max = null) {
        static $seeded;

        if (!isset($seeded)) {
          mt_srand((double)microtime()*1000000);
          $seeded = true;
        }

        if (isset($min) && isset($max)) {
          if ($min >= $max) {
            return $min;
          } else {
            return mt_rand($min, $max);
          }
        } else {
          return mt_rand();
        }
      }

        $width = 240;
        $height =50;

        $imgh = imagecreate($width, $height);
        // BOF - Tomcraft - 2009-11-06 - Set VVCODE Colors back to default
        // BOF - Dokuman - 2009-10-14 - Set VVCODE Colors to default template color
        $fonts = imagecolorallocate($imgh, 112, 112, 112);
        $lines = imagecolorallocate($imgh, 220, 148, 002);
        $background = imagecolorallocate($imgh, 196, 196, 196);
        /*
        $fonts = imagecolorallocate($imgh, 137, 55, 105);
        $lines = imagecolorallocate($imgh, 222, 222, 222);
        $background = imagecolorallocate($imgh, 180, 180, 180);
        */

        // EOF - Dokuman - 2009-10-14 - Set VVCODE Colors to default template color
        // BOF - Tomcraft - 2009-11-06 - Set VVCODE Colors back to default

        imagefill($imgh, 0, 0, $background);

        $x = xtc_rand(0, 20);
        $y = xtc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $i, 0, $z, $height, $lines);
            $i += $x;
            $z += $y;
        }

        $x = xtc_rand(0, 20);
        $y = xtc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $z, 0, $i, $height, $lines);
            $i += $x;
            $z += $y;
        }    
       
        $x = xtc_rand(0, 10);
        $y = xtc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $i, $width, $z, $lines);
            $i += $x;
            $z += $y;
        }

        $x = xtc_rand(0, 10);
        $y = xtc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $z, $width, $i, $lines);
            $i += $x;
            $z += $y;
        }      
       
        header('Content-Type: image/jpeg');
        imagejpeg($imgh);
        imagedestroy($imgh);  

    Gruss
    Hanspeter

    sandro22

    • Viel Schreiber
    • Beiträge: 589
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #108 am: 21. Juli 2014, 22:19:35
    hpzeller meinst du nicht die xtc_render_vvcode.inc.php

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #109 am: 21. Juli 2014, 22:33:53
    hpzeller meinst du nicht die xtc_render_vvcode.inc.php
    Nein, der Hintergrund ist das so alle includierten Scripte umgangen werden.

    PS:
    Es geht hier um die Fehlersuche, noch nicht um deren Behebung.

    Gruss
    Hanspeter

    sandro22

    • Viel Schreiber
    • Beiträge: 589
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #110 am: 21. Juli 2014, 22:36:11
    Einwunder zur später stunde. Das Captcha Bild ist vorhanden. Jedoch fehlt jetzt noch die schrift.

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #111 am: 21. Juli 2014, 22:45:17
    Einwunder zur später stunde. Das Captcha Bild ist vorhanden. Jedoch fehlt jetzt noch die schrift.
    okay, also weiter füge jetzt nach
    Code: PHP  [Auswählen]
       Released under the GNU General Public License  
       ---------------------------------------------------------------------------------------*/
    nacheinander folgende Zeilen ein
    Code: PHP  [Auswählen]
    require ('includes/application_top.php');
    require_once (DIR_FS_INC.'xtc_render_vvcode.inc.php');
    require_once (DIR_FS_INC.'xtc_random_charcode.inc.php');
    $visual_verify_code = xtc_random_charcode(6);
    $_SESSION['vvcode'] = $visual_verify_code;
    also immer eine Zeile und dann testen ob ein Bild erscheint.

    Gruss
    Hanspeter

    sandro22

    • Viel Schreiber
    • Beiträge: 589
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #112 am: 21. Juli 2014, 22:50:24
    mit dieser zeil
    Code: PHP  [Auswählen]
       $_SESSION['vvcode'] = $visual_verify_code;

    kommt das bild noch mit den anderen nicht.

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #113 am: 21. Juli 2014, 22:57:11
    Jede Zeile einzel probiert und es erscheint kein Bild mehr. ohne diese zeilen kommt das bild so wie vorhin.
    okay, dann entferne folgende Zeile
    Code: PHP  [Auswählen]
    require ('includes/application_top.php');
    und füge stattdessen folgende Zeile ein
    Code: PHP  [Auswählen]
    include ('includes/configure.php');

    Gruss
    Hanspeter

    sandro22

    • Viel Schreiber
    • Beiträge: 589
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #114 am: 21. Juli 2014, 23:03:04
    Hab jetzt diese 2 zeilen drin stehen.
    Code: PHP  [Auswählen]
    include ('includes/configure.php');
    $_SESSION['vvcode'] = $visual_verify_code;

    Und das Bild wird noch angezeigt, leider noch ohne schrift.

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #115 am: 21. Juli 2014, 23:08:12
    Hab jetzt diese 2 zeilen drin stehen.
    Code: PHP  [Auswählen]
    include ('includes/configure.php');
    $_SESSION['vvcode'] = $visual_verify_code;

    Und das Bild wird noch angezeigt, leider noch ohne schrift.

    Ja, aber dazwischen jetzt noch folgende Zeilen einfügen
    Code: PHP  [Auswählen]
    require_once (DIR_FS_INC.'xtc_render_vvcode.inc.php');
    require_once (DIR_FS_INC.'xtc_random_charcode.inc.php');
    $visual_verify_code = xtc_random_charcode(6);

    Gruss

    sandro22

    • Viel Schreiber
    • Beiträge: 589
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #116 am: 21. Juli 2014, 23:17:23
    Da kommt wider nichts.
    Die display_vvcodes.php sieht jetzt so aus.

    Code: PHP  [Auswählen]
    <?php

    /* -----------------------------------------------------------------------------------------
      $Id: display_vvcodes.php 831 2005-03-13 10:16:09Z mz $  
     
       Copyright (c) 2004 XT-Commerce
       -----------------------------------------------------------------------------------------
     
       Released under the GNU General Public License  
       ---------------------------------------------------------------------------------------*/

        include ('includes/configure.php');
        require_once (DIR_FS_INC.'xtc_render_vvcode.inc.php');
        require_once (DIR_FS_INC.'xtc_random_charcode.inc.php');
        $visual_verify_code = xtc_random_charcode(6);
        $_SESSION['vvcode'] = $visual_verify_code;
     
    function xtc_rand($min = null, $max = null) {
        static $seeded;
     
        if (!isset($seeded)) {
          mt_srand((double)microtime()*1000000);
          $seeded = true;
        }
     
        if (isset($min) && isset($max)) {
          if ($min >= $max) {
            return $min;
          } else {
            return mt_rand($min, $max);
          }
        } else {
          return mt_rand();
        }
      }
     
        $width = 240;
        $height =50;
     
        $imgh = imagecreate($width, $height);
        // BOF - Tomcraft - 2009-11-06 - Set VVCODE Colors back to default
        // BOF - Dokuman - 2009-10-14 - Set VVCODE Colors to default template color
        $fonts = imagecolorallocate($imgh, 112, 112, 112);
        $lines = imagecolorallocate($imgh, 220, 148, 002);
        $background = imagecolorallocate($imgh, 196, 196, 196);
        /*
        $fonts = imagecolorallocate($imgh, 137, 55, 105);
        $lines = imagecolorallocate($imgh, 222, 222, 222);
        $background = imagecolorallocate($imgh, 180, 180, 180);
        */

        // EOF - Dokuman - 2009-10-14 - Set VVCODE Colors to default template color
        // BOF - Tomcraft - 2009-11-06 - Set VVCODE Colors back to default
     
        imagefill($imgh, 0, 0, $background);
     
        $x = xtc_rand(0, 20);
        $y = xtc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $i, 0, $z, $height, $lines);
            $i += $x;
            $z += $y;
        }
     
        $x = xtc_rand(0, 20);
        $y = xtc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $z, 0, $i, $height, $lines);
            $i += $x;
            $z += $y;
        }    
       
        $x = xtc_rand(0, 10);
        $y = xtc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $i, $width, $z, $lines);
            $i += $x;
            $z += $y;
        }
     
        $x = xtc_rand(0, 10);
        $y = xtc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $z, $width, $i, $lines);
            $i += $x;
            $z += $y;
        }      
       
        header('Content-Type: image/jpeg');
        imagejpeg($imgh);
        imagedestroy($imgh);
    ?>

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #117 am: 21. Juli 2014, 23:23:10
    okay, dann entferne
    Code: PHP  [Auswählen]
    require_once (DIR_FS_INC.'xtc_render_vvcode.inc.php');

    Gruss

    sandro22

    • Viel Schreiber
    • Beiträge: 589
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #118 am: 21. Juli 2014, 23:32:48
    Bild ist da jedoch immer noch ohne Text. Ich habe die Fonts mal im ACII modus hochgeladen damit können wir das auch ausschliessen

    hpzeller

    • Experte
    • Beiträge: 4.129
    • Geschlecht:
    Re: Kontaktformular mit Captcha funktioniert nicht
    Antwort #119 am: 21. Juli 2014, 23:50:04

    ersetze in “display_vvcodes.php” alles zwischen “<?php” und ”?>” mit folgendem Code

    Code: PHP  [Auswählen]
    /* -----------------------------------------------------------------------------------------
      $Id: display_vvcodes.php 831 2005-03-13 10:16:09Z mz $  

       Copyright (c) 2004 XT-Commerce
       -----------------------------------------------------------------------------------------
     
       Released under the GNU General Public License  
       ---------------------------------------------------------------------------------------*/


    require ('includes/application_top.php');
    require_once(DIR_FS_INC . 'xtc_rand.inc.php');

    function vvcode_render_code($code) {
        if (!empty($code)) {

        // load fonts
        $ttf=array();
        if ($dir= opendir(DIR_WS_INCLUDES.'fonts/')){
        while  (($file = readdir($dir)) !==false) {
        if (is_file(DIR_WS_INCLUDES.'fonts/'.$file) and (strstr(strtoupper($file),'.TTF'))){
            $ttf[]=DIR_FS_CATALOG.'/includes/fonts/'.$file;
            }
            }
            closedir($dir);
        }
        $width = 240;
        $height =50;

        $imgh = imagecreate($width, $height);
        // BOF - Tomcraft - 2009-11-06 - Set VVCODE Colors back to default
        // BOF - Dokuman - 2009-10-14 - Set VVCODE Colors to default template color
        $fonts = imagecolorallocate($imgh, 112, 112, 112);
        $lines = imagecolorallocate($imgh, 220, 148, 002);
        $background = imagecolorallocate($imgh, 196, 196, 196);
        /*
        $fonts = imagecolorallocate($imgh, 137, 55, 105);
        $lines = imagecolorallocate($imgh, 222, 222, 222);
        $background = imagecolorallocate($imgh, 180, 180, 180);
        */

        // EOF - Dokuman - 2009-10-14 - Set VVCODE Colors to default template color
        // BOF - Tomcraft - 2009-11-06 - Set VVCODE Colors back to default

        imagefill($imgh, 0, 0, $background);

        $x = xtc_rand(0, 20);
        $y = xtc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $i, 0, $z, $height, $lines);
            $i += $x;
            $z += $y;
        }

        $x = xtc_rand(0, 20);
        $y = xtc_rand(20, 40);
        for ($i = $x, $z = $y; $i < $width && $z < $width;) {
            imageLine($imgh, $z, 0, $i, $height, $lines);
            $i += $x;
            $z += $y;
        }    
       
        $x = xtc_rand(0, 10);
        $y = xtc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $i, $width, $z, $lines);
            $i += $x;
            $z += $y;
        }

        $x = xtc_rand(0, 10);
        $y = xtc_rand(10, 20);
        for ($i = $x, $z = $y; $i < $height && $z < $height;) {
            imageLine($imgh, 0, $z, $width, $i, $lines);
            $i += $x;
            $z += $y;
        }    
           
        for ($i = 0; $i < strlen($code); $i++) {
            $font = $ttf[(int)xtc_rand(0, count($ttf)-1)];
            $size = xtc_rand(30, 36);
            $rand = xtc_rand(1,20);
            $direction = xtc_rand(0,1);

          if ($direction == 0) {
           $angle = 0-$rand;
        } else {
           $angle = $rand;
        }
          if (function_exists('imagettftext')) {                  
                  imagettftext($imgh, $size, $angle, 15+(36*$i) , 38, $fonts, $font, substr($code, $i, 1));  
          } else {                                            
            $tc = ImageColorAllocate ($imgh, 0, 0, 0); //Schriftfarbe - schwarz        
                  ImageString($imgh, $size, 26+(36*$i),20, substr($code, $i, 1), $tc);  
            }
        }                                                                              
                                                                                       
        header('Content-Type: image/jpeg');
        imagejpeg($imgh);
        imagedestroy($imgh);
     }
    }
    require_once (DIR_FS_INC.'xtc_random_charcode.inc.php');

    $visual_verify_code = xtc_random_charcode(6);
    $_SESSION['vvcode'] = $visual_verify_code;
    $vvimg = vvcode_render_code($visual_verify_code);

    Gruss
    Hanspeter
               
    anything