PHP interesse |
|
// Formulier maken
echo '<form action="index.php?page=settings" method="POST">' . "\r\n";
foreach($settings as $key => $value) {
//echo $key . ' => ' . $value . '<br />';
if (in_array($key, $no_change) === false) {
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12%"><label for="' . $key . '">' . $key . ':</label></td>
<td width="14%"><input width="12" name="' . $key . '" value="' . $value . '" /></td>
<td width="74%"> <input type="submit" name="set_' . $key . '" value="Set"></td>
</tr>
</table>' . "\r\n";
}
}
echo '<input type="submit" value="Set all" />' . "\r\n";
echo '</form>' . "\r\n";
echo '<a href="index.php?page=settings&action=reset">New configuration install</a><br>';
echo '<a href="index.php?page=restart">Restart your Server</a>';
?>
</fieldset>
// Formulier maken echo '<form action="index.php?page=settings" method="POST">' . "\r\n"; foreach($settings as $key => $value) { //echo $key . ' => ' . $value . '<br />'; if (in_array($key, $no_change) === false) { echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="12%"><label for="' . $key . '">' . $key . ':</label></td> <td width="14%"><input width="12" name="' . $key . '" value="' . $value . '" /></td> <td width="74%"> <input type="submit" name="set_' . $key . '" value="Set"></td> </tr> </table>' . "\r\n"; } } echo '<input type="submit" value="Set all" />' . "\r\n"; echo '<a href="index.php?page=settings&action=reset">New configuration install</a><br>'; echo '<a href="index.php?page=restart">Restart your Server</a>'; ?> </fieldset>
Allemaal al gebeurd.
// Settings ophaal functie
function save_settings($settings)
{
global $config_file, $seperator;
$file = fopen($config_file, 'w');
$write = '';
foreach ($settings as $key => $value) {
$write .= $key . $seperator . $value . "\r\n";
}
fwrite($file, $write);
fclose($file);
}
// Settings ophaal functie function save_settings($settings) { global $config_file, $seperator; $file = fopen($config_file, 'w'); $write = ''; foreach ($settings as $key => $value) { $write .= $key . $seperator . $value . "\r\n"; } }
<?php
// Setting bestand
// De array met standaard instellingen
$standard_settings = array(
'//HLTV' => 'Config copyright by SIS',
'Name' => '"HLTV by Test"',
'Hostname' => '"HLTV by Test"',
'Offlinetext' => '"Sorry the game is delayed. Please try again later"',
'Delay' => '90.0',
'Maxrate' => '6500',
'Logfile' => '1',
'Chatmode' => '1',
'Connect' => 'IP:Port',
'Serverpassword' => '"private"',
'Adminpassword' => '"yourrcon"',
);
<?php // Setting bestand // De array met standaard instellingen $standard_settings = array( '//HLTV' => 'Config copyright by SIS', 'Name' => '"HLTV by Test"', 'Hostname' => '"HLTV by Test"', 'Offlinetext' => '"Sorry the game is delayed. Please try again later"', 'Delay' => '90.0', 'Maxrate' => '6500', 'Logfile' => '1', 'Chatmode' => '1', 'Connect' => 'IP:Port', 'Serverpassword' => '"private"', 'Adminpassword' => '"yourrcon"', );
Zodra ik dus die " " bij: '"yourrcon"' weghaal, zie ik wel de value. Alleen niet als ik die " " erbij laat staan. En die " " zijn nodig in het Config bestand want anders werken ze niet. |