Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Skrypt nie działa na hostingu,choć powinien?!?
lulia
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 21.06.2017

Ostrzeżenie: (0%)
-----


Witam napisałam klasę odpowiadającą za walidację danych wejściowych pod Symfony. I wszystko fajnie, uruchamiany na dwóch serwach z ubuntu i php 7.Smiga aż miło,ale ....
Na serwerze produkcyjnym już nie sad.gif Może mi ktoś wytknąć błedy i powód.Albo pokazać gdzie jest błąd,a ja go nie widzę.

  1. class ValidationClass
  2. {
  3.  
  4. public function removeWhiteChars($string)
  5. {
  6. $this->string=trim($string);
  7. return $this->string;
  8. }
  9. public function stringFilter($string,$filter)
  10. {
  11. switch ($filter)
  12. {
  13. case "int":
  14. return preg_replace("/[^0-9]/","",$string);
  15. case "char":
  16. return preg_replace("/[^A-Za-z?![:space:]]/","",$string);
  17. case "char_nospace":
  18. return preg_replace("/[^A-Za-z]/","",$string);
  19. case "char_pl":
  20. return preg_replace("/[^A-Za-zĄĘÓŁŚŻŹĆŃ?![:space:]\?\!,.]/","",$string);
  21. case "all":
  22. return preg_replace("/[^0-9A-Za-zęółśąćźżńĄĘÓŁ\/ŚŻŹ\\\\ĆŃ?![:space:]\?\@!,#_.+-]/","",$string);
  23. case "date":
  24. return preg_replace("/[^0-9\/,.\\\\]/","",$string);
  25. }
  26.  
  27.  
  28. }
  29.  
  30. public function lengthControl($string,$min,$max)
  31. {
  32.  
  33. if($this->lengthControlEncoding($string, "auto") <= $max && $this->lengthControlEncoding($string, "auto") >= $min)
  34. {
  35. return true;
  36. } else
  37. {
  38. return FALSE;
  39. }
  40.  
  41. }
  42. public function showEncoding($string)
  43. {
  44. return mb_detect_encoding($string, "auto");
  45. }
  46. public function lengthControlEncoding($string,$encoding)
  47. {
  48. return mb_strlen($string, $encoding);
  49. }
  50. public function generalControl($string,$minL,$maxL,$generalFilter)
  51. {
  52. $this->removeWC=$this->removeWhiteChars($string);
  53. $this->preg=$this->stringFilter($this->removeWC,$generalFilter);
  54. $this->clear=$this->lengthControl($this->preg,$minL,$maxL);
  55. if($this->clear == true)
  56. {
  57. return $this->preg;
  58. }
  59. else
  60. {
  61. return null;
  62. }
  63.  
  64. }
  65. public function generalControlExit($string,$minL,$maxL,$generalFilter)
  66. {
  67. $this->removeWC=$this->removeWhiteChars($string);
  68. $this->preg=$this->stringFilter($this->removeWC,$generalFilter);
  69. $this->clear=$this->lengthControl($this->preg,$minL,$maxL);
  70. if($this->clear == true)
  71. {
  72. return $this->preg;
  73. }
  74.  
  75.  
  76. }
  77.  
  78. public function verificationWithoutDelete($string)
  79. {
  80. $this->str = mb_convert_encoding($string, 'UTF-8', 'UTF-8');
  81. $this->str = htmlentities($this->str, ENT_QUOTES, 'UTF-8');
  82.  
  83. return $this->str;
  84. }
  85.  
  86. }
  87.  
Go to the top of the page
+Quote Post
Pyton_000
post
Post #2





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


A może Ty nam pokażesz błędy z logów.

Sama klasa strasznie kuje w oczy...

Ten post edytował Pyton_000 25.08.2017, 07:22:56
Go to the top of the page
+Quote Post
lulia
post
Post #3





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 21.06.2017

Ostrzeżenie: (0%)
-----


niestety nie mam dostępu do logów sad.gif
ale problem powstaje tylko w funkcjach lengthControl oraz showEncoding
Go to the top of the page
+Quote Post
viking
post
Post #4





Grupa: Zarejestrowani
Postów: 6 380
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Zmień error_reporting oraz flagę display_errors. Może nie ma rozszerzenia mb?


--------------------
Go to the top of the page
+Quote Post
lulia
post
Post #5





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 21.06.2017

Ostrzeżenie: (0%)
-----


Nerwy mi puściły z supportem hostngu nie szło się dogadać. Po zmianie hostngu na inny wszystko bangla.
Widocznie coś tam nie było doinstalowane.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 21:44