Willkommen, Gast ( Anmelden | Registrierung )
07.01.2008 - 9:09
Beitrag
#1
|
|
|
Kommt Zeit, kommt Rat, kommt Conrad! Gruppe: Mods Beiträge: 1.169 Mitglied seit: 21.11.2001 Wohnort: Altenkirchen, Westerwald Mitglieds-Nr.: 42 |
Moin,
seit einiger Zeit plagen mir unerwünschte automatisch generierte Einträge in meinem Kontaktformular. Die Pflichtfelder werden mit nichtssagenden Floskeln ausgefüllt, der Texteintrag ist gefüllt mit Links zu zweifelhafte Seiten... Wie kann ich sowas verhindern? Weder der Meta Tag: <META NAME="robots" CONTENT="noindex,nofollow"> noch ein eintrag in meinem robots.txt scheint was zu bringen. cu Conny |
|
|
|
![]() |
07.01.2008 - 18:59
Beitrag
#2
|
|
|
Kommt Zeit, kommt Rat, kommt Conrad! Gruppe: Mods Beiträge: 1.169 Mitglied seit: 21.11.2001 Wohnort: Altenkirchen, Westerwald Mitglieds-Nr.: 42 |
Hallo,
bin bei "JAX" fündig geworden und bereits am basteln. Möchte gerne eine Hintergrundfarbe und auch nur eine Farbe für die Buchstaben/Zahlen. Hier die class.captcha.php CODE <?php class captcha { var $session_key = null; var $temp_dir = null; var $width = 160; var $height = 60; var $jpg_quality = 15; /** * Constructor - Initializes Captcha class! * * @param string $session_key * @param string $temp_dir * @return captcha */ function captcha( $session_key, $temp_dir ) { $this->session_key = $session_key; $this->temp_dir = $temp_dir; } /** * Generates Image file for captcha * * @param string $location * @param string $char_seq * @return unknown */ function _generate_image( $location, $char_seq ) { $num_chars = strlen($char_seq); $img = imagecreatetruecolor( $this->width, $this->height ); imagealphablending($img, 1); imagecolortransparent( $img ); // generate background of randomly built ellipses for ($i=1; $i<=200; $i++) { $r = round( rand( 0, 100 ) ); $g = round( rand( 0, 100 ) ); $b = round( rand( 0, 100 ) ); $color = imagecolorallocate( $img, $r, $g, $b ); imagefilledellipse( $img,round(rand(0,$this->width)), round(rand(0,$this->height)), round(rand(0,$this->width/16)), round(rand(0,$this->height/4)), $color ); } $start_x = round($this->width / $num_chars); $max_font_size = $start_x; $start_x = round(0.5*$start_x); $max_x_ofs = round($max_font_size*0.9); // set each letter with random angle, size and color for ($i=0;$i<=$num_chars;$i++) { $r = round( rand( 127, 255 ) ); $g = round( rand( 127, 255 ) ); $b = round( rand( 127, 255 ) ); $y_pos = ($this->height/2)+round( rand( 5, 20 ) ); $fontsize = round( rand( 18, $max_font_size) ); $color = imagecolorallocate( $img, $r, $g, $b); $presign = round( rand( 0, 1 ) ); $angle = round( rand( 0, 25 ) ); if ($presign==true) $angle = -1*$angle; ImageTTFText( $img, $fontsize, $angle, $start_x+$i*$max_x_ofs, $y_pos, $color, 'default.ttf', substr($char_seq,$i,1) ); } // create image file imagejpeg( $img, $location, $this->jpg_quality ); flush(); imagedestroy( $img ); return true; } /** * Returns name of the new generated captcha image file * * @param unknown_type $num_chars * @return unknown */ function get_pic( $num_chars=8 ) { // define characters of which the captcha can consist $alphabet = array( 'A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z', '1','2','3','4','5','6','7','8','9','0' ); $max = sizeof( $alphabet ); // generate random string $captcha_str = ''; for ($i=1;$i<=$num_chars;$i++) // from 1..$num_chars { // choose randomly a character from alphabet and append it to string $chosen = rand( 1, $max ); $captcha_str .= $alphabet[$chosen-1]; } // generate a picture file that displays the random string if ( $this->_generate_image( $this->temp_dir.'/'.'cap_'.md5( strtolower( $captcha_str )).'.jpg' , $captcha_str ) ) { $fh = fopen( $this->temp_dir.'/'.'cap_'.$this->session_key.'.txt', "w" ); fputs( $fh, md5( strtolower( $captcha_str ) ) ); return( md5( strtolower( $captcha_str ) ) ); } else { return false; } } /** * check hash of password against hash of searched characters * * @param string $char_seq * @return boolean */ function verify( $char_seq ) { $fh = fopen( $this->temp_dir.'/'.'cap_'.$this->session_key.'.txt', "r" ); $hash = fgets( $fh ); if (md5(strtolower($char_seq)) == $hash) return true; else return false; } } ?> Hier lässt sich wahrscheinlich mein Problem lösen; habe bei den r, g, b schon probiert. Werte auf 255 für Weiß und auf 0 für Schwarz. Klappt aber noch nicht so wie ich möchte wahrscheinlich übersehe ich da was... Bitte nachhelfen! cu Conny |
|
|
|
Conny Die Robots und das Kontaktformular 07.01.2008 - 9:09
harlequin moin!
Das Problem ist, dass diese Spammer sic... 07.01.2008 - 9:39
Andreas ZITAT(Conny @ 07.01.2008 - 9:09) sei... 07.01.2008 - 10:36
Thomas Eine weitere Idee: Da es den Spammern meist um die... 07.01.2008 - 13:20
Conny Ok, vielen Dank.
ich werde mir diese 'Captchas... 07.01.2008 - 14:06
Andreas ZITAT(Conny @ 07.01.2008 - 14:06) Se... 07.01.2008 - 15:08
Andreas ZITAT(Conny @ 07.01.2008 - 18:59) Mö... 07.01.2008 - 20:07
Conny Hallo,
bin bereits ein Stückchen weiter.
Die Code ... 07.01.2008 - 23:49
Thomas Ohne jetzt ganz genau auf den Code geguckt zu habe... 08.01.2008 - 8:37
Conny Moin Thomas,
wenn ich an der Stelle include verwe... 08.01.2008 - 10:08
Andreas ZITAT(Conny @ 08.01.2008 - 10:08) An... 08.01.2008 - 10:25
Thomas ZITAT(Conny @ 08.01.2008 - 10:08) An... 08.01.2008 - 10:52
Conny Wenn ich statt include header('Location: konta... 08.01.2008 - 10:56
Thomas Mit dem Aufruf von header() wird ein neuer Request... 08.01.2008 - 11:00
Conny Ja, da haben sich unsere Postings überschnitten.
I... 08.01.2008 - 11:10
Thomas Ich habe in der Regel ein Skript - wenn ein Fehler... 08.01.2008 - 11:25
Andreas ZITAT(Thomas @ 08.01.2008 - 11:25) P... 08.01.2008 - 13:16
Conny ZITAT(Thomas @ 08.01.2008 - 11:25) P... 08.01.2008 - 15:19
Thomas Hmmm - zurück über JS ist zwar ganz nett, aber bei... 08.01.2008 - 19:17
Conny Hallo Thomas,
Nun denn, das Ergebnis ist OnLine ... 08.01.2008 - 21:34
Thomas Irgendwie hatte ich mir das komplett anders vorges... 09.01.2008 - 8:37
Conny So, ich glaube ich habe eine elegante Lösung gefun... 08.01.2008 - 20:58
Conny Moin Thomas,
vielen Dank für die Testreihe!
Di... 09.01.2008 - 10:01
Thomas ZITAT(Conny @ 09.01.2008 - 10:01) Di... 09.01.2008 - 11:03
Conny Moin Thomas,
HTMLif ($_POST['nam... 10.01.2008 - 8:39
Thomas ZITAT(Conny @ 10.01.2008 - 8:39) HTM... 10.01.2008 - 9:21
harlequin moin!
ZITAT(Thomas @ 10.01.2008 - 9... 10.01.2008 - 9:48
Thomas ZITAT(harlequin @ 10.01.2008 - 9:48)... 10.01.2008 - 10:13
harlequin ZITAT(Thomas @ 10.01.2008 - 10:13) Z... 10.01.2008 - 11:31
Thomas ZITAT(harlequin @ 10.01.2008 - 11:31... 10.01.2008 - 12:07
harlequin ZITAT(Thomas @ 10.01.2008 - 12:07) Z... 10.01.2008 - 12:35![]() ![]() |
|
Vereinfachte Darstellung | Aktuelles Datum: 08.12.2025 - 10:21 |