voilà j'ai un problème
voilà le code
<?
flush();
function WakeOnLan($addr, $mac)
{
$addr_byte = explode('-', $mac);
$hw_addr = '';
for ($a=0; $a < 6; $a++) $hw_addr .= chr(hexdec($addr_byte[$a]));
$msg = chr(255).chr(255).chr(255).chr(255).chr(255).chr(255);
for ($a = 1; $a <= 16; $a++) $msg .= $hw_addr;
// send it to the broadcast address using UDP
// SQL_BROADCAST option isn't help!!
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if ($s == false)
{
echo "Error creating socket!\n";
echo "Error code is '".socket_last_error($s)."' - " . socket_strerror(socket_last_error($s));
}
else
{
// setting a broadcast option to socket:
$opt_ret = socket_set_option($s, 1, 6, TRUE);
if($opt_ret < 0)
{
echo "setsockopt() failed, error: " . strerror($opt_ret) . "\n";
}
$e = socket_sendto($s, $msg, strlen($msg), 0, $addr, 2050);
socket_close($s);
echo "Magic Packet sent (".$e.") to ".$addr.", MAC=".$mac;
}
}
$bdd=mysql_connect("localhost","root","");
mysql_select_db("plop",$bdd);
$requete = "SELECT IP FROM postes WHERE NAME =\"".$_POST['pc']."\" GROUP BY IP";
$result = mysql_query ($requete);
while ($ress = mysql_fetch_array($result)) {
$adrip = $ress['IP'];
}
$req = "SELECT MAC FROM postes WHERE NAME =\"".$_POST['pc']."\" GROUP BY MAC";
$res = mysql_query ($req);
while ($re = mysql_fetch_array($res)) {
$adrmac = $re['MAC'];
}
WakeOnLan($adrip, $adrmac)
?>
et voici l'erreur :
Code : Tout sélectionner
Warning: socket_set_option() [function.socket-set-option]: unable to set socket option [0]: Un argument non valide a été fourni. in D:\Program Files\xampp\htdocs\plop\wol2.php on line 36
Magic Packet sent (102) to 172.16.214.3, MAC=00-30-F1-13-56-59merci d'avance
:: CoiKispiCs ::