1 pièce(s) jointe(s)
Impossible de récuperer des valeurs POST.
Bonjour je suis confronté à un problème qui, comme le peut en témoigner l'heure, me donne du fil a retordre.
pourquoi validerRcon.php ne récupère pas les valeur POST (ip, port, rcon) que je lui envoie ?
alors que validerIP.php récupère ses mêmes valeurs POST (ip, port)
Merci d'avance ;)
voila mon code JS :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <script type="text/javascript">
$(document).ready(function(){
// texte affiché
var rcon = $('#rcon').val();
var ip = $('#ip').val();
var port = $('#port').val();
//Quand
$('#rcon').blur(function(){
//Vérification de la validité du port
if (($('#rcon').val().length == 0) || ($('#ip').val().length > 15) || ($('#port').val().length == 0))
{
// Si = 0 affichage de l'erreur
$('#status_rcon').html('<img src="images/cross.png" height="16" width="16" /> Vous n\'avez pas rentré de password RCON ou d\'adresse IP');
}
else
{
// Sinon affichage du statut de la recherche puis lance la recherche en appellant la fonction verification_rcon
$('#status_rcon').html('<img src="images/chargement.gif" height="16" width="16" /> Vérification en cours...');
verification_rcon();
}
});
function verification_rcon(){
//utilisation d'ajax pour faire le test de la présence d'un serveur de jeu possédant cette ip et étant encore sous contrat
$.post("validerRcon.php", { ip: ip, port: port, rcon: rcon},
function(result)
{
//Si le résultat est 1
if(result == 1)
{
$('#status_rcon').html( '<img src="images/accept.png" height="16" width="16" /> Vous êtes bien le propriétaire du serveur');
}
else
{
$('#status_rcon').html( '<img src="images/cross.png" height="16" width="16" /> Vous n\'êtes pas propriétaire du serveur [erreur rcon ou le serveur est offline]');
}
});
}
}); </script> |
et voila ma page validerRcon.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <?php
# Source RCON by William Ruckman (http://ruckman.net)
define('PACKET_SIZE', '1400');
define('SERVERQUERY_INFO', "\xFF\xFF\xFF\xFFTSource Engine Query");
define ('REPLY_INFO', "\x49");
define('SERVERQUERY_GETCHALLENGE', "\xFF\xFF\xFF\xFF\x57");
define ('REPLY_GETCHALLENGE', "\x41");
define('SERVERDATA_AUTH', 3) ;
define ('SERVERDATA_EXECCOMMAND', 2) ;
class srcds_rcon
{
function getLong(&$string)
{
blabalbal, on s\'en fiche;
}
function rcon_command($ip, $port, $rcon)
{
$requestId = 1;
$s2 = '';
$socket = @fsockopen ('tcp://'.$ip, $port, $errno, $errstr, 30);
if (!$socket)
return 0;
$data = pack("VV", $requestId, SERVERDATA_AUTH).$rcon.chr(0).$s2.chr(0);
$data = pack("V",strlen($data)).$data;
fwrite ($socket, $data, strlen($data));
$requestId++ ;
$junk = fread ($socket, PACKET_SIZE);
$string = fread ($socket, PACKET_SIZE);
$size = $this->getLong($string);
$id = $this->getLong($string) ;
if ($id == -1)
{
return 0;
}
else
{
return 1; //Si bon rcon : alors on retourne 1, sinon 0
}
}
}
if (isset($_POST['ip']) && isset($_POST['port']) && isset($_POST['rcon']))
{
$ip = ($_POST['ip']);
$port = ($_POST['port']);
$rcon = ($_POST['rcon']);
$srcds_rcon = new srcds_rcon();
$srcds_rcon->rcon_command($ip, $port, $rcon);
}
?> |