![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 32 Pomógł: 2 Dołączył: 22.01.2008 Ostrzeżenie: (0%) ![]() ![]() |
Witam. Wiec mam juz skrypt na liste serwerów online pewnej gry...
Prawie wszystko działa tylko, przy dodawaniu serwerów przez uzytkownika ukazuje sie taki błąd: Cytat <BR>Fatal error: Call to undefined function: socket_create() in /home/accounts_o/ots/public_html/lista/Pages/addserver.php on line 35 A tutaj kod źrdołowy plki addserver.php. co jest z linią 35 tego skryptu? Kod <? if ($show == 1) { if (isset($_SESSION['id'])) { if (isset($_POST['submit'])){ $ownerid = $_SESSION['id']; $ip = addslashes(htmlspecialchars($_POST['ip'])); $port = addslashes(htmlspecialchars($_POST['port'])); $desc = trim(htmlentities($_POST['desc'], ENT_QUOTES)); $location = $_POST['location']; $connection = $_POST['connection']; $fel = 0; if (empty($desc)){ $fel = 1; error("Wypełni pole opis.", 1); } $conn = @fsockopen ("$ip", "$port",$null,$errstr,1); if (!$conn) { $fel = 1; error("Nie można nawiązać połączenia z serwerem.<br> Żeby dodać serwer do listy musi być online.", 1); } $ipcheck = mysql_num_rows(mysql_query("SELECT * FROM servers WHERE ip='".$ip."'")); if ($ipcheck > 0){ $fel = 1; error("Ten adres Ip już jest zarejestrowany w bazie.", 1); } if ($fel != 1) { //Hämta xml info frĺn servern till variabeln $data $info = chr(6).chr(0).chr(255).chr(255).'info'; $s = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); socket_connect($s, $ip, $port); socket_send($s, $info, 8, 0); $a = ''; $data = ''; while(socket_recv($s, $a, 1024, 0)) { $data .= $a; } socket_close($s); //Ladda infon frĺn xml $stack = array(); $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startTag", "endTag"); xml_set_character_data_handler($xml_parser, "cdata"); $data = xml_parse($xml_parser, $data); if(!$data) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } xml_parser_free($xml_parser); $info = array(); foreachzor($stack, $info); |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 2 592 Pomógł: 445 Dołączył: 12.03.2007 Ostrzeżenie: (0%) ![]() ![]() |
Nie masz zdefiniowanej funkcji socket_create() co może być spowodowane Twoją wersją php:
Cytat socket_create
(PHP 4 >= 4.0.7, PHP 5) -------------------- |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 32 Pomógł: 2 Dołączył: 22.01.2008 Ostrzeżenie: (0%) ![]() ![]() |
Sprawdziłem sobie i:
Current PHP version: 4.4.7 MySQL server version: 4.1.22-log I co teraz? ;/ |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 2 592 Pomógł: 445 Dołączył: 12.03.2007 Ostrzeżenie: (0%) ![]() ![]() |
Tak sobie dumam, że jeśli nie ma żadnej literówki, to jedynym wyjściem jest, że te funkcje nie są włączone.
Cytat The socket functions described here are part of an extension to PHP which must be enabled at compile time by giving the --enable-sockets option to configure. Możesz sprawdzić czy w ogóle funkcja jest np tak:
Ten post edytował vokiel 24.01.2008, 08:28:43 -------------------- |
|
|
![]() ![]() |
![]() |
Aktualny czas: 19.08.2025 - 12:24 |