if ($porthttp) { $posEgal = strpos($porthttp, '='); $longueur = strlen($porthttp); $RemotePort = substr($porthttp, $posEgal + 1); } if ($access_password) { $posEgal = strpos($access_password, '='); $longueur = strlen($access_password); $access_password2 = trim(substr($access_password, $posEgal + 1)); $longueur2 = strlen($access_password2); $Remote_access_password = substr($access_password2, 1, $longueur2 - 2); } } fclose($fp); // $myRemoteAdmin = new RemoteAdmin(trim($hostnameSSH), trim($RemotePort), trim($Remote_access_password)); $myRemoteAdmin = new RemoteAdmin(trim($hostnameSSH), trim($RemotePort), trim($access_password2)); //********************************* // === Commande BACKUP === //********************************* $today = mktime(0, 0, 0, date("m"), date("d"), date("y")); if ($_POST['backup_sim'] == '1' && $_POST['format_backup'] == 'OAR') { $parameters = array('region_name' => $_POST['name_sim'], 'filename' => 'BackupOAR_' . $_POST['name_sim'] . '_' . date(d_m_Y_h) . '.oar'); $myRemoteAdmin->SendCommand('admin_save_oar', $parameters); } echo '<div class="alert alert-success alert-anim">'; echo '<i class="glyphicon glyphicon-ok"></i>'; echo ' Fichier en cours de creation, veuillez consulter le <strong>Log</strong> ...'; echo '</div>'; } //****************************************************** // Affichage page principale
$btnN1 = ""; $btnN2 = ""; $btnN3 = ""; } } //SECURITE MOTEUR /* ************************************ */ echo '<h1>' . $osmw_index_4 . '</h1>'; echo '<div class="clearfix"></div>'; //****************************************************** //* Selon ACTION bouton => Envoi Commande via Remote Admin //****************************************************** if (isset($_POST['cmd'])) { $RemotePort = RecupRAdminParam_Opensim(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim, " port = "); $access_password2 = RecupRAdminParam_Opensim(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim, " access_password = "******" " . $_POST['last']; $parameters = array('command' => 'save iar ' . $fullname . ' / ' . $_POST['pass'] . ' BackupIAR_' . $_POST['first'] . '_' . $_POST['last'] . '_' . date(d_m_Y_h) . '.iar'); $myRemoteAdmin->SendCommand('admin_console_command', $parameters); echo "<div class='alert alert-success alert-anim'>"; echo "<i class='glyphicon glyphicon-ok'></i>"; echo " " . $osmw_label_msg_inventaire1 . " <strong>" . $fullname . "</strong>, " . $osmw_label_msg_inventaire2 . " ...</div>"; } else { echo "<div class='alert alert-danger alert-anim'>"; echo "<i class='glyphicon glyphicon-remove'></i>"; echo " <strong>Login</strong> or <strong>Password</strong> error ...</div>"; } } }
echo '<FORM METHOD=POST ACTION=""> <TABLE> <TR> <TD>(Listen)IntValue:</TD> <TD><INPUT TYPE="text" NAME="intvalue"></TD> </TR> <TR> <TD>(Commande)StringValue:</TD> <TD><INPUT TYPE="text" NAME="stringvalue"></TD> </TR> <TR> <TD> </TD> <TD><INPUT TYPE="submit" NAME="envoi"></TD> </TR> </TABLE> <BR> <BR> </FORM>'; //"up,upx2,down,downx2,white1","red1","green1","blue1","steel1","orange1","yellow1","pink1","purple1","sky1","lavander1","OFF" if ($_POST['envoi']) { $myRemoteAdmin = new RemoteAdmin('localhost', 20800, ''); $type_parameters = array('Channel' => 'string', 'IntValue' => 'int', 'StringValue' => 'string', 'Channel' => $channel, 'IntValue' => (int) $POST_int, 'StringValue' => $POST_string); $myRemoteAdmin->SendCommand('llRemoteData', $type_parameters); if ($retour === FALSE) { echo 'ERROR'; } } //****************************************************** } else { header('Location: index.php'); }
} // Niv 3 if ($_SESSION['privilege'] == 2) { $btnN1 = ""; $btnN2 = ""; } // Niv 2 if ($_SESSION['privilege'] == 1) { $btnN1 = ""; } // Niv 1 // ****************************************************** $channel = "d8e93046-dcfc-4a65-81ab-25554eee893f"; // "up, upx2, down, downx2, white1", "red1","green1","blue1","steel1","orange1","yellow1","pink1","purple1","sky1","lavander1","OFF" if ($_POST['cmd'] == "Envoyer") { $myRemoteAdmin = new RemoteAdmin('localhost', 9000, '***'); $params = array('Channel' => 'string', 'IntValue' => 'int', 'StringValue' => 'string', 'Channel' => $channel, 'IntValue' => (int) $POST_int, 'StringValue' => $POST_string); $myRemoteAdmin->SendCommand('llRemoteData', $params); if ($retour === FALSE) { echo '<p>Erreur Remote Admin ...</p>'; } } echo '<form class="form-group" method="post" action="">'; echo '<table class="table table-hover">'; echo '<tr>'; echo '<th>Action</th>'; echo '<th>Value</th>'; echo '</tr>'; echo '<tr>'; echo '<td><h5>(Listen) int Value:</h5></td>'; echo '<td><input class="form-control" type="text" name="intvalue"></td>';
$btnN1 = ""; $btnN2 = ""; $btnN3 = ""; } } //SECURITE MOTEUR /* ************************************ */ echo '<h1>' . $osmw_index_3 . '</h1>'; echo '<div class="clearfix"></div>'; //****************************************************** //* Selon ACTION bouton => Envoi Commande via Remote Admin //****************************************************** if (isset($_POST['cmd'])) { $RemotePort = RecupRAdminParam_Opensim(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim, " port = "); $access_password2 = RecupRAdminParam_Opensim(INI_Conf_Moteur($_SESSION['opensim_select'], "address") . $FichierINIOpensim, " access_password = "******"name_sim = ".$_POST['name_sim']; if ($_POST['save_terrain'] == '1' && $_POST['cmd'] == 'Save BMP') { $parameters = array('region_name' => $_POST['name_sim'], 'filename' => 'BackupMAP_' . $_POST['name_sim'] . '_' . date(d_m_Y_h) . '.bmp'); $myRemoteAdmin->SendCommand('admin_save_heightmap', $parameters); } if ($_POST['save_terrain'] == '1' && $_POST['cmd'] == 'Save RAW') { $parameters = array('region_name' => $_POST['name_sim'], 'filename' => 'BackupMAP_' . $_POST['name_sim'] . '_' . date(d_m_Y_h) . '.raw'); $myRemoteAdmin->SendCommand('admin_save_heightmap', $parameters); } echo '<div class="alert alert-success alert-anim" role="alert">'; echo '<strong><center>' . $osmw_label_consult_log . ' ... <br> <br></center></strong>';