Ten skrypt zapisze do pliku shoutcast.conf informacje takie jak sloty,port,hasla itp. pobrane z formularza .
<?php
$dane = "MaxUser=" . $_POST['sloty'] . "/n"
. "Password=" . $_POST['haslo'] . "/n"
. "PortBase=" . $_POST['port'] . "/n"
. "AdminPassword=" . $_POST['adminhaslo'] . "/n"
. "PublicServer=" . $_POST['public'] . "/n";
$file = "shoutcast.conf";
$fp = fopen($file, "a");
flock($fp, 2);
fwrite($fp, $dane);
flock($fp, 3);
fclose($fp);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<title>blaballaaaa</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="blablaaa" />
<meta name="description" content="blablaaa" />
</head>
<body>
<form action="" method="post">
<fieldset>
<legend>Stworz serwer SHOUTcast</legend>
<label for="sloty">Sloty:</label>
<input type="text" id="sloty" name="sloty" value="'.$_POST['sloty'].'"/> </br>
<label for="haslo">Haslo nadawania:</label>
<input type="text" id="haslo" name="haslo" value="'.$_POST['haslo'].'"/> </br>
<label for="port">Port:</label>
<input type="text" id="port" name="logi" value="'.$_POST['port'].'"/> </br>
<label for="adminhaslo">AdminPassword:</label>
<input type="text" id="adminhaslo" name="adminhaslo" value="'.$_POST['adminhaslo'].'"/> </br>
<label for="public">PublicServer:</label>
<input type="text" id="public" name="public" value="'.$_POST['public'].'"/> </br>
<label for="login">Login:</label>
<input type="text" id="login" name="login" value="'.$_POST['login'].'"/> </br>
<input type="submit" value="Stworz" id="send" name="send" />
<?php
$sloty = $_POST["sloty"];
$haslo = $_POST["haslo"];
$port = $_POST["port"];
$adminhaslo = $_POST["adminhaslo"];
if (isset($_POST['send'])) {
if (empty($nick) {
echo "Proszę podać ilość slotów! <br />";
}elseif (empty($haslo)) {
echo "Proszę podać haslo do nadawania!"<br />";
}elseif (empty($port)) {
echo "Proszę podać port!"<br />";
}elseif (empty($adminhaslo)) {
echo "Proszę podać haslo admina!"<br />";
}else {
echo "Twoj serwer zostal stworzony!";
}
}
?>
</fieldset>
</form>
</body>
</html>
Uruchamianie shoutcast'a
<?php
$login = $_POST['login'];
system('./sc_serv $login . ".conf"');
?>
Mogą być błędy bo nie pisałem z kompilatorem , jak coś poprawcie mnie .