Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Problem z rejestracją na stronie
Forum PHP.pl > Forum > Przedszkole
Rajdon
Witam, mam problem z rejestracją na stronie, a dokładniej z kodem zabezpieczającym
Tak to wygląda

Gdy klima w przeładuj obrazek to nic się nie dzieje a obrazek dalej jest ten sam i dzieje się tak tylko gdy w panelu admina wybieram j.polski bo w angielskim wszytko jest ok. Jak to naprawić?
Spawnm
Pokaż kod... ale chyba masz błąd w 124 linijce winksmiley.jpg
Rajdon
website.lng (J.polski)

Fragment z przeładowniem obrazka:

Kod
.................// 6.0
'reload_code'         =>"(przeładuj obrazek)",
'news_err_31'        =>    "Twój komentarz został dodany do bazy. Po sprawdzeniu przez administratora, zostanie opublikowany na stronie.",
'bb_t_font'               =>    "Typ",
'bb_t_size'               =>    "Rozmiar",
// 6.0

// 5.7
'mail_news'        =>    "Artykuł oczekuje na akceptację.",
'mail_comments'        =>    "Nowy komentarz na stronie",
'bb_t_leech'        =>    "Wstaw zabezpieczony URL",
// 5.7

// 5.5
's_ffullstart'        =>    "Szukanie zaawansowane",
'user_logged'        =>    "Zostałe¶ pomy¶lnie zalogowany!",
// 5.5................................................
Spawnm
po co pokazałeś mi kawałek tablicy ?
Popraw polskie znaki winksmiley.jpg

I pokaż kod odpowiadający za to co nie działa ...
Rajdon
Spawnm pokazałem ci kawałek sposzczenia bo to właśnie w nim jest problem tylko nie wiem gdzie ;/
Plik odpowiedzialny za przełądowanie obrazka to antibot.php ale on działa no bo gdy przełącze w PA na j.angielski to jest ok ;]

Antibot.php

  1. <?php
  2.  
  3. @error_reporting(E_ALL ^ E_NOTICE);
  4. @ini_set('display_errors', true);
  5. @ini_set('html_errors', false);
  6. @ini_set('error_reporting', E_ALL ^ E_NOTICE);
  7.  
  8. function clean_url ($url) {
  9.  
  10.  if ($url == '') return;
  11.  
  12.  $url = str_replace("http://", "", $url);
  13.  if (strtolower(substr($url, 0, 4)) == 'www.')  $url = substr($url, 4);
  14.  $url = explode('/', $url);
  15.  $url = reset($url);
  16.  $url = explode(':', $url);
  17.  $url = reset($url);
  18.  
  19.  return $url;
  20. }
  21.  
  22. if (clean_url($_SERVER['HTTP_REFERER']) != clean_url($_SERVER['HTTP_HOST'])) die("Fack You!");
  23.  
  24. class genrandomimage {
  25.    
  26.    var $alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
  27.  
  28.    var $fontsdir = 'fonts';    
  29.  
  30.    var $width = 120;
  31.    var $height = 50;
  32.    var $fluctuation_amplitude = 2;
  33.    var $no_spaces = true;
  34.    var $jpeg_quality = 100;
  35.    var $keystring = '';
  36.    var $allowed_symbols = "023456789";
  37.    var $length_min = 3;
  38.    var $length_max = 3;
  39.    var $length = 0;
  40.    function genstring() {
  41.  
  42.        $length = mt_rand( $this->length_min, $this->length_max );
  43.        $this->length = $length;
  44.        
  45.        while (true) {
  46.            $this->keystring = '';
  47.            for ($i = 0; $i < $length ; $i++) {
  48.                $this->keystring .= $this->allowed_symbols{ mt_rand( 0, strlen( $this->allowed_symbols ) -1 ) };
  49.            }
  50.            if (!preg_match( '/cp|cb|ck|c6|c9|rn|rm|co|do/', $this->keystring )) break;
  51.        }
  52.    }
  53.  
  54.    function genimage() {
  55.  
  56.        $foreground_color = array( mt_rand( 0, 100 ), mt_rand( 0, 100 ), mt_rand( 0, 100 ) );
  57.        $background_color = array( mt_rand( 200, 255 ), mt_rand( 200, 255 ), mt_rand( 200, 255 ) );
  58.  
  59.        $fonts = array();
  60.        $fontsdir_absolute = dirname( __FILE__ ).'/'.$this->fontsdir;
  61.  
  62.        if ($handle = opendir( $fontsdir_absolute )) {
  63.            while (false !== ($file = readdir( $handle ))) {
  64.                if (preg_match( '/.png$/i', $file )) {
  65.                    $fonts[] = $fontsdir_absolute.'/'.$file;
  66.                }
  67.            }
  68.            closedir( $handle );
  69.        }
  70.  
  71.        $alphabet_length = strlen( $this->alphabet );
  72.        
  73.        while (true) {
  74.            $font_file = $fonts[mt_rand( 0, count( $fonts ) - 1 )];
  75.            $font = imagecreatefrompng( $font_file );
  76.            $black = imagecolorallocate( $font, 0, 0, 0 );
  77.            $fontfile_width = imagesx( $font );
  78.            $fontfile_height = imagesy( $font ) - 1;
  79.            $font_metrics = array();
  80.            $symbol = 0;
  81.            $reading_symbol = false;
  82.  
  83.            for ($i = 0; $i < $fontfile_width && $symbol < $alphabet_length; $i++) {
  84.                $transparent = (imagecolorat( $font, $i, 0 ) >> 24) == 127;
  85.  
  86.                if (!$reading_symbol && !$transparent) {
  87.                    $font_metrics[$this->alphabet{$symbol}] = array( 'start' => $i );
  88.                    $reading_symbol = true;
  89.                    continue;
  90.                }
  91.  
  92.                if ($reading_symbol && $transparent) {
  93.                    $font_metrics[$this->alphabet{$symbol}]['end'] = $i;
  94.                    $reading_symbol = false;
  95.                    $symbol++;
  96.                    continue;
  97.                }
  98.            }
  99.  
  100.            $img = imagecreatetruecolor( $this->width, $this->height );
  101.  
  102.            $white = imagecolorallocate( $img, 255, 255, 255 );
  103.            $black = imagecolorallocate( $img, 0, 0, 0 );
  104.  
  105.            imagefilledrectangle( $img, 0, 0, $this->width - 1, $this->height - 1, $white );
  106.  
  107.            $x = 1;
  108.            $shift = 0;
  109.            
  110.            for ($i = 0; $i < $this->length; $i++) {
  111.                $m = $font_metrics[$this->keystring{$i}];
  112.  
  113.                $y = mt_rand( -$this->fluctuation_amplitude, $this->fluctuation_amplitude ) + ($this->height - $fontfile_height) / 2 + 2;
  114.                
  115.                if ($this->no_spaces) {
  116.                    $shift = 0;
  117.                    if ($i > 0) {
  118.                        $shift = 1000;
  119.                        for ($sy = 1; $sy < $fontfile_height - 15; $sy += 2) {
  120.                            for ($sx = $m['start'] - 1; $sx < $m['end']; $sx++) {
  121.                                $rgb = imagecolorat( $font, $sx, $sy );
  122.                                $opacity = $rgb >> 24;
  123.                                if ($opacity < 127) {
  124.                                    $left = $sx - $m['start'] + $x;
  125.                                    $py = $sy + $y;
  126.                                    for ($px = min( $left, $this->width - 1 ); $px > $left - 15 && $px >= 0; $px--) {
  127.                                        $color = imagecolorat( $img, $px, $py ) & 0xff;
  128.                                        if ($color + $opacity < 190) {
  129.                                            if ($shift > $left-$px) {
  130.                                                $shift = $left - $px;
  131.                                            }
  132.                                            break;
  133.                                        }
  134.                                    }
  135.                                    break;
  136.                                }
  137.                            }
  138.                        }
  139.                    }
  140.                } else {
  141.                    $shift = 1;
  142.                }
  143.                
  144.                imagecopy( $img, $font, $x - $shift, $y, $m['start'], 1, $m['end'] - $m['start'], $fontfile_height );
  145.                
  146.                $x += $m['end'] - $m['start'] - $shift;
  147.            }
  148.            if ($x < $this->width - 10) break;
  149.        }
  150.        $center = $x/2;
  151.        
  152.        $img2=imagecreatetruecolor($this->width, $this->height);
  153.        $foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
  154.        $background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]);
  155.        imagefilledrectangle($img2, 0, $this->height, $this->width, $this->height+12, $foreground);
  156.  
  157.        $rand1 = mt_rand( 750000, 1200000 ) / 10000000;
  158.        $rand2 = mt_rand( 750000, 1200000 ) / 10000000;
  159.        $rand3 = mt_rand( 750000, 1200000 ) / 10000000;
  160.        $rand4 = mt_rand( 750000, 1200000 ) / 10000000;
  161.  
  162.        $rand5 = mt_rand( 0, 3141592 ) / 500000;
  163.        $rand6 = mt_rand( 0, 3141592 ) / 500000;
  164.        $rand7 = mt_rand( 0, 3141592 ) / 500000;
  165.        $rand8 = mt_rand( 0, 3141592 ) / 500000;
  166.  
  167.        $rand9 = mt_rand( 330, 420 ) / 110;
  168.        $rand10 = mt_rand(330, 450 ) / 110;
  169.  
  170.        for ($x = 0; $x < $this->width; $x++) {
  171.            for ($y = 0; $y < $this->height; $y++) {
  172.                $sx = $x + (sin( $x * $rand1 + $rand5 ) + sin( $y * $rand3 + $rand6 )) * $rand9 - $this->width / 2 + $center + 1;
  173.                $sy = $y + (sin( $x * $rand2 + $rand7 ) + sin( $y * $rand4 + $rand8 )) * $rand10;
  174.  
  175.                if ($sx < 0 || $sy < 0 || $sx >= $this->width - 1 || $sy >= $this->height - 1) {
  176.                    $color = 255;
  177.                    $color_x = 255;
  178.                    $color_y = 255;
  179.                    $color_xy = 255;
  180.                } else {
  181.                    $color = imagecolorat( $img, $sx, $sy ) & 0xFF;
  182.                    $color_x = imagecolorat( $img, $sx + 1, $sy ) & 0xFF;
  183.                    $color_y = imagecolorat( $img, $sx, $sy + 1 ) & 0xFF;
  184.                    $color_xy = imagecolorat( $img, $sx + 1, $sy + 1 ) & 0xFF;
  185.                }
  186.  
  187.                if ($color == 0 && $color_x == 0 && $color_y == 0 && $color_xy == 0) {
  188.                    $newred = $foreground_color[0];
  189.                    $newgreen = $foreground_color[1];
  190.                    $newblue = $foreground_color[2];
  191.                } else if ($color == 255 && $color_x == 255 && $color_y == 255 && $color_xy == 255) {
  192.                    $newred = $background_color[0];
  193.                    $newgreen = $background_color[1];
  194.                    $newblue = $background_color[2];    
  195.                } else {
  196.                    $frsx = $sx - floor( $sx );
  197.                    $frsy = $sy - floor( $sy );
  198.                    $frsx1 = 1 - $frsx;
  199.                    $frsy1 = 1 - $frsy;
  200.                    $newcolor = (
  201.                        $color    * $frsx1 * $frsy1 +
  202.                        $color_x  * $frsx  * $frsy1 +
  203.                        $color_y  * $frsx1 * $frsy  +
  204.                        $color_xy * $frsx  * $frsy);
  205.  
  206.                    if ($newcolor > 255) $newcolor = 255;
  207.                    $newcolor = $newcolor / 255;
  208.                    $newcolor0 = 1 - $newcolor;
  209.  
  210.                    $newred      = $newcolor0 * $foreground_color[0] + $newcolor * $background_color[0];
  211.                    $newgreen = $newcolor0 * $foreground_color[1] + $newcolor * $background_color[1];
  212.                    $newblue  = $newcolor0 * $foreground_color[2] + $newcolor * $background_color[2];
  213.                }
  214.  
  215.                imagesetpixel( $img2, $x, $y, imagecolorallocate( $img2, $newred, $newgreen, $newblue ) );
  216.            }
  217.        }
  218.  
  219.      imageline( $img2, 0, 0,  $this->width, 0, $foreground );
  220.      imageline( $img2, 0, 0,  0, $this->height, $foreground );
  221.  
  222.      imageline( $img2, 0, $this->height-1,  $this->width, $this->height-1, $foreground );
  223.      imageline( $img2, $this->width-1, 0,  $this->width-1, $this->height, $foreground);
  224.  
  225.        header( "Expires: Tue, 11 Jun 1985 05:00:00 GMT" );
  226.        header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
  227.        header( "Cache-Control: no-store, no-cache, must-revalidate" );
  228.        header( "Cache-Control: post-check=0, pre-check=0", false );
  229.        header( "Pragma: no-cache" );
  230.        header( "Content-Type: image/jpeg" );
  231.        imagejpeg($img2, null, $this->jpeg_quality);
  232.    }
  233.  
  234. }
  235.  
  236.  
  237. $im = new genrandomimage();
  238. $im->genstring();
  239.  
  240. $_SESSION['sec_code_session'] = $im->keystring;
  241.  
  242. $im->genimage();
  243. ?>


jak to naprawić ? Dlaczego w j.angielskim wszytko jest ok a w polskim nie ?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.