Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] PHP Notice: Use of undefined constant
Forum PHP.pl > Forum > Przedszkole
marcin0077
Witam

W logach serwera mam takie błędy:

  1. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant red - assumed 'red' in /var/www/strona/Captcha/class.simplecaptcha.php on line 232
  2. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant green - assumed 'green' in /var/www/strona/Captcha/class.simplecaptcha.php on line 233
  3. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant blue - assumed 'blue' in /var/www/strona/Captcha/class.simplecaptcha.php on line 234
  4. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant red - assumed 'red' in /var/www/strona/Captcha/class.simplecaptcha.php on line 232
  5. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant green - assumed 'green' in /var/www/strona/Captcha/class.simplecaptcha.php on line 233
  6. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant blue - assumed 'blue' in /var/www/strona/Captcha/class.simplecaptcha.php on line 234
  7. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant red - assumed 'red' in /var/www/strona/Captcha/class.simplecaptcha.php on line 203
  8. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant green - assumed 'green' in /var/www/strona/Captcha/class.simplecaptcha.php on line 203
  9. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant blue - assumed 'blue' in /var/www/strona/Captcha/class.simplecaptcha.php on line 203
  10. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant red - assumed 'red' in /var/www/strona/Captcha/class.simplecaptcha.php on line 205
  11. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant green - assumed 'green' in /var/www/strona/Captcha/class.simplecaptcha.php on line 205
  12. [Mon Sep 26 10:32:10 2011] [error] [client 66.249.71.72] PHP Notice: Use of undefined constant blue - assumed 'blue' in /var/www/strona/Captcha/class.simplecaptcha.php on line 205


Fragment kodu:

  1. function generateImage($text = null)
  2. {
  3. $im = imagecreatefrompng( $this->getBackgroundImage() );
  4. $tColor = $this->getTextColor();
  5. $txcolor = $this->colorDecode($tColor);
  6. $bcolor = $this->getBackgroundColor();
  7. $bgcolor = $this->colorDecode($bcolor);
  8. $width = $this->getWidth();
  9. $height = $this->getHeight();
  10. $transprency = $this->getTransparency();
  11. $this->im = imagecreate($width,$height);
  12. //Linia 203
  13. $imgColor = imagecolorallocate($this->im, $bgcolor[red], $bgcolor[green], $bgcolor[blue]);
  14. imagecopymerge($this->im,$im,0,0,0,0,$width,$height,$transprency);
  15. $textcolor = imagecolorallocate($this->im, $txcolor[red], $txcolor[green], $txcolor[blue]);
  16. $font = $this->getFont();
  17. $fontsize=$this->getFontSize();
  18. $minAngle = $this->getTextMinimumAngle();
  19. $maxAngle = $this->getTextMaximumAngle();
  20. $length = $this->getTextLength();
  21.  
  22. for($i=0;$i<$length;$i++){
  23. imagettftext(
  24. $this->im,
  25. $fontsize,
  26. rand(-$minAngle,$maxAngle),
  27. $i*15+10,
  28. $this->FontSize*1.2,
  29. $textcolor,
  30. $font,
  31. substr($text, $i, 1));
  32. }
  33.  
  34. imagepng($this->im);
  35. imagedestroy($this->im);
  36. }
  37.  
  38. function colorDecode( $hex ){
  39.  
  40. if(!isset($hex)) return FALSE;
  41. //Linia 230
  42. $decoded[red] = hexdec(substr($hex, 0 ,2));
  43. $decoded[green] = hexdec(substr($hex, 2 ,2));
  44. $decoded[blue] = hexdec(substr($hex, 4 ,2));
  45.  
  46. return $decoded;
  47.  
  48. }
  49.  
  50.  
  51. }



Próbowałem do kolorów red, blue green dodawac quote ( $imgColor = imagecolorallocate($this->im, $bgcolor["red"], $bgcolor["green"], $bgcolor["blue"]); )
ale nic to nie dało.
W czym tkwi problem?

Proszę o pomoc
nospor
właśnie ma być "red" lub 'red'
Jeśli nic nie dało to:
albo patrzyłeś na stare logi a nie na nowe
albo masz te redy jeszcze w innych miejscach i nie zmieniłeś wszędzie
albo zmieniasz plik ale zmian nie wrzucasz na serwer
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.