Old 8th December 2003, 05:33   #1
SCaster
Junior Member
 
Join Date: Dec 2003
Posts: 5
Changing password "on fly"

Hello,

I would be interested to know if there is a way to change the broadcaster password "on fly" via PHP script.

I did try the following method:

created somefilename.conf

created a php which writes Password=newpassword via post (htaccess protected)

changed Password=somepass to Include /pathto/somefilename.conf

added cron job to stop the server every 1 min before a full hour

So what I can do is typing a new password and wait until the cron restarts the sc_serv to apply the changes.

The problem here is that it always gives a Invalid password meaning it seems like it doesnt accept the included password conf file

Any suggestions how I could make it work ?

Thanks
SCaster is offline   Reply With Quote
Old 8th December 2003, 12:25   #2
DJHotIce
Forum Loser
(Forum King)
 
DJHotIce's Avatar
 
Join Date: Jan 2003
Location: That place I can't remember the name.
Posts: 4,617
Send a message via AIM to DJHotIce Send a message via Yahoo to DJHotIce
did your DSP get the changed password as well? That sounds like the prob.

-DJHotIce
Bounce Multimedia - Professional Web Design
DJHotIce is offline   Reply With Quote
Old 11th December 2003, 03:51   #3
SCaster
Junior Member
 
Join Date: Dec 2003
Posts: 5
Yes all changes were applied. It seems like sc_serv ignores the Password=somepass include function - maybe a bug ?
SCaster is offline   Reply With Quote
Old 11th December 2003, 04:21   #4
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
What exactly are you putting in for the Password section (i.e. please post an example)?

FesterHead is offline   Reply With Quote
Old 11th December 2003, 05:05   #5
SCaster
Junior Member
 
Join Date: Dec 2003
Posts: 5
PHP Code to create a new password:

PHP Code:
<?php
echo"
<center>
<form action=index.php method=post>
New Password : <input type=text name=pass1 value=
$pass1><br>
<center>
<input type=hidden name=save value=yes>
<input type=submit value=\"Add Password\">
</center>
</form>
"
;
if(
$save == 'yes')
{
$c="Password=$pass1";
$writestuff="$c";

$filename="passconf.conf";
$file fopen($filename"w");
fwrite($file"$writestuff");
fclose($file);
echo
"<meta http-equiv=\"refresh\" content=\"3 url=index.php\">";
echo 
"<center>New Password Accepted...</center>";
}
?>
PHP Script creates a file (passconf.conf) which just contains one line:

Password=thenewpassword


The sc_serv.conf looks like this: (only the part up to the include)


; SHOUTcast Distributed Network Audio Server configuration file
; Copyright (C) 1998-2002 Nullsoft, Inc.
; All Rights Reserved.
; Last modified Jan 16 2002

; If you want to manage multiple configurations, just copy
; this file to another name, and run sc_serv with that name
; such as:
; sc_serv.exe sc_leet.conf

; ***************************
; Required stuff
; ***************************
Include=/path/to/passconf.conf
; MaxUser. The maximum number of simultaneous listeners allowed.
; Compute a reasonable value for your available upstream bandwidth (i.e. if
; you have 256kbps upload DSL, and want to broadcast at 24kbps, you would
; choose 256kbps/24kbps=10 maximum listeners.) Setting this value higher
; only wastes RAM and screws up your broadcast when more people connect
; than you can support.
MaxUser=500


The line Password=somepassword is replaced by the include function which should read the passconf.conf after the server was restarted.

Doesn't work for some reason - It always gives "Invalid Password" as answer.
SCaster is offline   Reply With Quote
Old 11th December 2003, 05:38   #6
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
The following isn't valid DNAS config syntax:
Include=/path/to/passconf.conf

The DNAS doesn't process any includes.

FesterHead is offline   Reply With Quote
Old 11th December 2003, 06:27   #7
SCaster
Junior Member
 
Join Date: Dec 2003
Posts: 5
From sc_serv.conf:


; Include: instructs the sc_serv to read from the named configuration file,
; *at the point of insertion of the Include statement*, and process as though
; the included file was part of itself. Note that all configuration parameters
; in the DNAS config file are processed first to last, so if an item is defined
; twice in a configuration, the last item to process will be the one that takes
; effect. For this reason, it's usually a good idea to use the Includes first
; in a config file.
; example:
; Include=/usr/local/shoutcast/common.conf
; Default is not applicable.




Normally it should if this info is correct ?!
SCaster is offline   Reply With Quote
Old 11th December 2003, 15:19   #8
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Heh. Just goes to show I don't know everything

Re-evaluating the thread, I'd say it should work.

Is the path to the include file relative to the directory the DNAS is instantiated from?

(Also, check file permissions)

Try writing the include file to the same directory as the DNAS and use (example):
Include=myinclude.conf

FesterHead is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump