par
moogli » 02 sept. 2016, 13:47
salut,
je suis étonné que cela fonctionne pour wow sachant que la variable host n'existe pas
<?php
// ip , port
function wowstatus($ip, $port) {
// alors ça non. en dev tu te fais une conf local, sinon y a des chances que ça reste et c'est pas top ;)
error_reporting(0);
// ici c'est $ip pas $host
$test = fsockopen($host,$port,$errno,$errstr,3);
if(!$test)
{ echo "<b style=\"color:red\">Hors Ligne</b>"; }
else { echo "<b style=\"color:green\">En Ligne</b>"; }
}
as tu testé les deux indépendamment ?
en dehors de ça il n'y a rien d'étonnant dans ton code.
je ne sais pas dans quel état sont tes jeux mais un test rapide me donne ceci
Heure du test : 02/09/2016 13:46:52
Status wow : Hors Ligne
--------------------------------------------------------------------------------
Status GM : En Ligne
code de test
<?php
$ipwow = "37.187.163.75";
$portwow = "8085";
$ipgmod = "37.187.163.75";
$portgmod = "27015";
function wowstatus($ip, $port)
{
error_reporting(0);
$test = fsockopen($host, $port, $errno, $errstr, 3);
if (!$test) {
echo "<b style=\"color:red\">Hors Ligne</b>";
} else {
echo "<b style=\"color:green\">En Ligne</b>";
}
}
function gmodstatus($ipgmod, $portgmod)
{
error_reporting(0);
$sock = fsockopen("udp://".$ipgmod, $portgmod, $num, $error, 2);
if (!$sock) {
echo("<b style=\"color:red;\">Hors Ligne</b>");
}
if ($sock) {
echo("<b style=\"color:green;\">En Ligne</b>");
fclose($sock);
}
}
echo 'Heure du test : ',date('d/m/Y H:i:s'),'<br />';
echo 'Status wow : ',wowstatus($ipwow, $portwow),'<hr/>';
echo 'Status GM : ',gmodstatus($ipgmod, $portgmod),'<hr/>';
@+
salut,
je suis étonné que cela fonctionne pour wow sachant que la variable host n'existe pas
[php]<?php
// ip , port
function wowstatus($ip, $port) {
// alors ça non. en dev tu te fais une conf local, sinon y a des chances que ça reste et c'est pas top ;)
error_reporting(0);
// ici c'est $ip pas $host
$test = fsockopen($host,$port,$errno,$errstr,3);
if(!$test)
{ echo "<b style=\"color:red\">Hors Ligne</b>"; }
else { echo "<b style=\"color:green\">En Ligne</b>"; }
}[/php]
as tu testé les deux indépendamment ?
en dehors de ça il n'y a rien d'étonnant dans ton code.
je ne sais pas dans quel état sont tes jeux mais un test rapide me donne ceci
[quote]Heure du test : 02/09/2016 13:46:52
Status wow : Hors Ligne
--------------------------------------------------------------------------------
Status GM : En Ligne[/quote]
code de test
[php]<?php
$ipwow = "37.187.163.75";
$portwow = "8085";
$ipgmod = "37.187.163.75";
$portgmod = "27015";
function wowstatus($ip, $port)
{
error_reporting(0);
$test = fsockopen($host, $port, $errno, $errstr, 3);
if (!$test) {
echo "<b style=\"color:red\">Hors Ligne</b>";
} else {
echo "<b style=\"color:green\">En Ligne</b>";
}
}
function gmodstatus($ipgmod, $portgmod)
{
error_reporting(0);
$sock = fsockopen("udp://".$ipgmod, $portgmod, $num, $error, 2);
if (!$sock) {
echo("<b style=\"color:red;\">Hors Ligne</b>");
}
if ($sock) {
echo("<b style=\"color:green;\">En Ligne</b>");
fclose($sock);
}
}
echo 'Heure du test : ',date('d/m/Y H:i:s'),'<br />';
echo 'Status wow : ',wowstatus($ipwow, $portwow),'<hr/>';
echo 'Status GM : ',gmodstatus($ipgmod, $portgmod),'<hr/>';[/php]
@+