Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] debugowanie kodu..
-gox-
post
Post #1





Goście







Witam, oto moj pierwszy skrypt w OO php5 i mam sporo problemow z jego zdebugowaniem:

  1. <?php
  2.  
  3. $t = new telnet('host', '21');
  4. $t->loop();
  5.  
  6. class telnet {
  7.  
  8. public $fp;
  9.  
  10. public __construct($host, $port) {
  11. if (!empty($host) or !empty($port)) trigger_error('telnet __construct - brak hosta/portu', E_USER_ERROR);
  12. if (!preg_match('#^[0-255]{1,3}.[0-255]{1,3}.[0-255]{1,3}.[0-255]{1,3}$#', $host)) {
  13. $ip = gethostbyname($host);
  14. if ($ip != $host) $host = $ip;
  15. else trigger_error("telnet __construct - Bledny host - '$host'", E_USER_ERROR);
  16. }
  17. if ($port < 0 or $port > 65536) trigger_error("telnet __construct - Nieprawidlowy port - '$port'", E_USER_ERROR);
  18. if ( (self::$fp = fsockopen($host, $port)) == false ) trigger_error("telnet __construct - Blad polaczenia!", E_USER_ERROR);
  19. }
  20.  
  21. public __destruct() {
  22. if (@fclose(self::$fp))
  23. return true;
  24. else return false;
  25. }
  26.  
  27. public function loop() {
  28. $out = '';
  29. while(self::$fp) {
  30. $dane = '';
  31. if ($dane = self::input('o.txt') != false) {
  32. fwrite(self::$fp, "$daner");
  33. while(!feof(self::$fp))$out.= fread(self::$fp, 1024);
  34. }
  35. self::ajax($out);
  36. //sleep(1);
  37. }
  38. self::close();
  39. return true;
  40. }
  41.  
  42. private function ajax ($dane) {
  43. $dane = str_replace(''', ''', $dane);
  44. echo '<script type="text/javascript">
  45. $('response').innerHTML = '' . $dane . '';
  46. </script>';
  47. return true;
  48. }
  49.  
  50. private function input ($plik) {
  51. if ($fp = fopen($plik, 'r') == false)
  52. return false;
  53. while(!feof($fp)) $fget.= fgets($fp);
  54. fclose($fp);
  55. unlink($plik);
  56. return $fget;
  57. }
  58.  
  59. }
  60. ?>


Jako pierwszy jest blad: Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE on line 174

o co mu chodzi?
Go to the top of the page
+Quote Post

Posty w temacie
- gox   [PHP] debugowanie kodu..   22.06.2008, 08:57:47
- - gox   linia 174 to ta : if (!preg_match('#^[0-2...   22.06.2008, 08:59:02
- - mike   Stos błędów. 1. Brak słowa kluczowego function dl...   22.06.2008, 10:10:32


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

 



RSS Aktualny czas: 7.10.2025 - 17:23