Location: PHPKode > projects > phpSC > modules/createserver.php
<?PHP
if(isset($_POST['name'])) {
$name = $_POST['name'];
$conf = date('U').".conf";
$contents = ";PHPSC GENERATED CONFIGURATION FILE FOR $name.
MaxUser=32
Password=changeme
PortBase=8002
;LogFile=sc_serv.log
;RealTime=1
;ScreenLog=1
;ShowLastSongs=10
;TchLog=yes
;WebLog=no
;W3CEnable=Yes
;W3CLog=sc_w3c.log
;SrcIP=ANY
;DestIP=ANY
;Yport=80
;NameLookups=0
;RelayPort=8000
;RelayServer=192.168.1.58
;AdminPassword=adminpass
;AutoDumpUsers=0
;AutoDumpSourceTime=30
;ContentDir=./content
;IntroFile=c:\intro%d.mp3
;BackupFile=C:\intro%d.mp3
;TitleFormat=Justin Radio: %s
;URLFormat=http://www.server.com/redirect.cgi?url=%s
;PublicServer=default
;AllowRelay=Yes
;AllowPublicRelay=Yes
;MetaInterval=32768
;ListenerTimer=600
;BanFile=sc_serv.ban
;RipFile=sc_serv.rip
;RIPOnly=No
;Unique=my_server
;Include=/usr/local/shoutcast/common.conf
;CpuCount=1
;Sleep=833
;CleanXML=No";
$filename = _CONFIG_DIR.$conf;
$file = fopen($filename,'w');
if(fwrite($file,$contents)) {
$message = "New Server Created.<BR>You must now go and edit the configuration file for your new server.";
chmod($filename, 0777);
$sql = "INSERT INTO servers (id, name, pid, conf, status) VALUES (NULL, '".$name."', NULL, '".$conf."', '0')";
mysql_query($sql,$conn) or die(mysql_error());
} else {
$message = "Couldn't write the new configuration file.<BR>Make sure the /bin/conf directory is CHMOD'ed to 777.";
}
}
?>
<form name="form1" method="post" action="<?= $_SERVER['REQUEST_URI'] ?>">
  <label>
  <div align="center">This is the name of the server that will show up in both Shoutcast, and in the database.<br /> 
    Make sure you name it well! <br />
    <br />
    Server Name
    <input name="name" type="text" id="name">
  </div>
  </label>
  <label>
  <div align="center">
    <input type="submit" name="Submit" value="Submit">
  </div>
  </label>
</form>
<center>
<?= $message ?>
</center>

Return current item: phpSC