Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Zmienne i curl
Faden
post
Post #1





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 9.03.2017

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


Hej. To znowu ja. Wybaczcie że tyle tematów ale nie moge nic znalezc na ten temat na necie. Wiem już mniej więcej co dolega temu skryptowi. Chodzi o zmienne $number i $id. Curl źle odczytuje te wartości. Możecie mi powiedzieć dlaczego?

  1. {
  2. $nick = $_POST['nick'];
  3. $check = $_POST['check'];
  4. $file = $players_folder.$nick.'.xml';
  5.  
  6. if( file_exists($file) )
  7. {
  8. //Sprawdzacz kodu
  9. $id = $shop['id'];
  10. $number = $offer[$offerId]['number'];
  11. $ch = curl_init("http://api.panelmh.mintshost.pl/'.$id.'/'.number.'/'.$check.'/'.$nick.'"); //inicjacja curla
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  13. $json = curl_exec($ch); //pobieranie treści strony
  14. curl_close($ch); //zamykanie curla
  15. $json1 = json_decode($json);
  16. echo "$json";
  17. if( empty($check) || empty($nick) )
  18. $message = "Please fill all fields.";
  19. else if( preg_match('/[^0-9A-Za-z]/', $check) )
  20. $message = "Entered code is not valid.";
  21. else if( $json1['code'] != 400 )
  22.  
  23. $message = "Entered code is not valid1.";
  24. else
  25. {
  26. $xml = simplexml_load_file($file);
  27. $xml['banned'] = 0;
  28. $xml->ban['banned'] = 0;
  29. $xml->ban['banstart'] = 0;
  30. $xml->ban['banend'] = 0;
  31. $xml->ban['reason'] = "";
  32. $xml->ban['action'] = "";
  33. $xml->ban['deleted'] = 0;
  34. $xml->ban['finalwarning'] = 0;
  35. $xml->ban['namelock'] = 0;
  36. $xml->asXML($file);
  37. $message = "You have been unbanned.";
  38. }
  39. }
  40. else
  41. $message = "<font color='red'><b>This character do not exists!</b></font>";
  42. }


Jeżeli chcecie cały kod, wyślę w nastepnym poscie
Go to the top of the page
+Quote Post

Posty w temacie


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: 21.08.2025 - 17:01