function sendmagick() { $page = CurrentPageName(); $tpl = new templates(); $comp = new computers($_GET["uid"]); $wakeup_computer = $tpl->javascript_parse_text("{wakeup_computer}"); $title = $tpl->_ENGINE_parse_body("{wakeup_computer}:{$comp->DisplayName}"); $user = new usersMenus(); echo "<div><code style='font-size:14px'>{$title}</div>"; if (!$user->AsArticaAdministrator) { echo "<H2>" . $tpl->javascript_parse_text("{ERROR_NO_PRIVS}") . "</H2>"; return; } echo $tpl->_ENGINE_parse_body("<div><code style='font-size:14px'>{ComputerMacAddress}: {$comp->ComputerMacAddress}</div>"); $wol = new Wol(); echo "<H2>" . $tpl->_ENGINE_parse_body($wol->wake($comp->ComputerMacAddress)) . "</H2>"; }
$systemid = $item->ID; if (!isset($protectedGet['option']) and !isset($protectedGet['cat'])) { $protectedGet['cat'] = 'admin'; } echo '<div class="left-menu">'; show_computer_menu($item->ID); echo '</div>'; echo '<div class="right-content">'; show_computer_title($item); if (isset($protectedGet['cat']) and $protectedGet['cat'] == 'admin') { show_computer_summary($item); } //Wake On Lan function if (isset($protectedPost["WOL"]) and $protectedPost["WOL"] == 'WOL' and $_SESSION['OCS']['profile']->getRestriction('WOL', 'NO') == "NO") { require_once 'require/function_wol.php'; $wol = new Wol(); $sql = "select MACADDR,IPADDRESS from networks WHERE (hardware_id=%s) and status='Up'"; $arg = array($item->ID); $resultDetails = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); $msg = ""; while ($item = mysqli_fetch_object($resultDetails)) { $wol->wake($item->MACADDR, $item->IPADDRESS); if ($wol->wol_send == $l->g(1282)) { msg_info($wol->wol_send . "=>" . $item->MACADDR . "/" . $item->IPADDRESS); } else { msg_error($wol->wol_send . "=>" . $item->MACADDR . "/" . $item->IPADDRESS); } } } if ($ajax) { ob_end_clean();
if (!$this->nic) { echo "probleme de connexion<br>"; echo "{$errstr} ({$errno})<br />\n"; fclose($this->nic); return false; } else { fwrite($this->nic, $this->pacquet($mac)); fclose($this->nic); return true; } } private function pacquet($Mac) { $packet = ""; for ($i = 0; $i < 6; $i++) { $packet .= chr(0xff); } for ($j = 0; $j < 16; $j++) { for ($i = 0; $i < 12; $i = $i + 2) { $packet .= chr(hexdec(substr($Mac, $i, 2))); } } return $packet; } } $wol = new Wol(); // Remplacer 001122334455 par l'adresse mac du pc à allumer $wol->wake('000EA62DA59C'); // $p_mac = secure_string("00:0E:A6:2D:A5:9C"); ?>