Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

Reply
Thread Tools Search this Thread Display Modes
Old 17th April 2006, 11:32   #1
aintschy
Junior Member
 
Join Date: Apr 2006
Posts: 1
"Kick Source" script

Hi folks,
i've coded a tiny script for sb. to kick the source of (unlimited) SHOUTcast servers. this is useful if you've got several djs streaming via the same server. perhaps some shoutcast users may profit from this script, too.

features:
- password protection
- xtra password protection to kick source
- view status of selected server
- kick source easily
- unlimited servers supported

requires:
- php 4/5

tested with:
- php 5 (xampp localhost)

configuration:
- type in var. values for user/pw
- enter servers and paramters in arrays

PHP Code:
<?php

// COPYRIGHT 2006 by aintschie (stationscript@gmx.net)

// SET ALL CONFIG VALUES

$login_user        "user";
$login_password        "1234";
$kick_password         "kickit";
$timeout        5;            // SECONDS TO WAIT FOR CONNECTION


$shoutcast_ip        = array("127.0.0.1",    "127.0.0.2");
$shoutcast_name        = array("Stream #1",    "Stream #2");    
$shoutcast_port        = array("8000",        "8000");
$shoutcast_password    = array("pw1",    "pw2");

if(
$_SERVER***91;'PHP_AUTH_USER'***93; != "$login_user" || $_SERVER***91;'PHP_AUTH_PW'***93; != "$login_password") {
 
header('WWW-Authenticate: Basic realm="SHOUTcast | KICK SOURCE"');
 
header('HTTP/1.0 401 Unauthorized');
 echo 
'<html><head><title>SHOUTcast - Kick source</title></head><body bgcolor="#C6E2FF" text="black">';
 echo 
'<h1>SHOUTcast - Source manager<hr width="100%" size="1" color="black" noshade></h1>';
 echo 
'<font face="Verdana" size="3" color="red"><b>Authorisation failed</b></font><br>';
 echo 
'<font face="Verdana" size="2"><b>Reload this page and <a href="'.$_SERVER***91;'PHP_SELF'***93;.'" style="color: black;">try login again</a></b></font></body></html>';
 exit; }  
?>

<html>
<head>
<title>SHOUTcast - Kick source</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<style>
 td {
  border:1px black solid; }
 font { font-family: Verdana; }
</style>
</head>

<body bgcolor="#C6E2FF" text="black">

<h1>SHOUTcast - Source manager

<hr width="100%" size="1" color="black" noshade></h1>

<font size="2">Select stream:</font>
<form method="get" style="margin: 0px;">
 <select name="id" style="border: 1px solid black;">
  <option value="0">>> Please choose</option>
  <?php
    $id 
$_REQUEST***91;'id'***93;;

    if(!isset(
$_REQUEST***91;'id'***93;) || $id == ''$id 0;

    for(
$x=0;$x<count($shoutcast_ip);$x++) {
     if(
$x == $id) echo "  <option value=\"$x\" selected>".$shoutcast_name***91;$x***93;." | ".$shoutcast_ip***91;$x***93;.":".$shoutcast_port***91;$x***93;."</option>\n";
     else echo 
"  <option value=\"$x\">".$shoutcast_name***91;$x***93;." | ".$shoutcast_ip***91;$x***93;.":".$shoutcast_port***91;$x***93;."</option>\n";
    }
  
?>
 </select>
 <input name="send2" type="submit" value=">> Select!" style="border: 1px solid black;">
</form>
<br>

<?php

 $kickit 
$_POST***91;'password_kick'***93;;

 if(isset(
$_POST***91;'send'***93;)) {

  if(
$kickit != "$kick_password") {

    
$mess "Password wrong. Source(s) not kicked";
    
$col  "red";

   echo 
"<table width=\"400\" cellpadding=\"2\">
     <tr>
      <td width=\"100%\" bgcolor=\"$col\"><font size=\"2\"><b>Notice</b></font></td>
     </tr>
     <tr>
      <td width=\"100%\" bgcolor=\"white\" height=\"60\"><font size=\"2\">$mess</font></td>
     </tr>
    </table><br>"
;
  echo 
"<meta http-equiv=refresh content=4;URL=".$_SERVER***91;'PHP_SELF'***93;."?id=$id>"; }

  else {

   if(
$_POST***91;'kick_all'***93; ==  'true') { $start 0$end  count($shoutcast_ip); }
   else  { 
$start $id$end  $start+1; }

   for(
$s=$start;$s<$end;$s++)
   {

    
$fp = @fsockopen($shoutcast_ip***91;$s***93;, $shoutcast_port***91;$s***93;, &$errno, &$errstr$timeout);

    if (
$fp) {
     
$mess "Source <b>".$shoutcast_ip***91;$s***93;."</b> successfully kicked.";
     
$col  "green";

     @
fputs($fp,"GET /admin.cgi?pass=".$shoutcast_password***91;$s***93;."&mode=kicksrc HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
     @
fclose($fp); }
    else {
     
$mess "Connection parameters wrong. Source <b>".$shoutcast_ip***91;$s***93;."</b> not kicked.";
     
$col  "red"; } 

   echo 
"<table width=\"400\" cellpadding=\"2\">
     <tr>
      <td width=\"100%\" bgcolor=\"$col\"><font size=\"2\"><b>Notice</b></font></td>
     </tr>
     <tr>
      <td width=\"100%\" bgcolor=\"white\" height=\"60\"><font size=\"2\">$mess</font></td>
     </tr>
    </table><br>"
;
  } 
// END FOR
  
echo "<meta http-equiv=refresh content=4;URL=".$_SERVER***91;'PHP_SELF'***93;."?id=$id>";
 }  
}

?>

<li><font size="2"><b>Service description</b><br>This service is used to kick your SHOUTcast source via webclient</font>

<li><font size="2"><b>Source details</b></font><br>
<?php
 $fp 
= @fsockopen($shoutcast_ip***91;$id***93;, $shoutcast_port***91;$id***93;, &$errno, &$errstr$timeout);
 if(
$fp) {
  
fputs($fp,"GET /admin.cgi?pass=".$shoutcast_password***91;$id***93;." HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
  while(!
feof($fp)) { $cont .= fgets($fp128); }
  
$cont strip_tags($cont);
  if(
ereg("Server is currently down"$cont)) { echo "<font size=\"2\"><font color=\"red\">Server is down/source is disconnected</font> >> Kickin' source has <b>no</b> effect</font>"; }
  elseif(
ereg("Server is currently up"$cont)) { echo "<font size=\"2\"><font color=\"green\">Server is up/source is connected</font> >> Kickin' source has effect</font>"; }
  else { echo 
"<font size=\"2\" color=\"red\">Unknown server/source status</font>"; }
   }
 else  echo 
"<font size=\"2\" color=\"red\">Couldn't connect to server. Is server really up?</font>";
?>



<li><font size="2"><b>Kick source</b><br>Enter password and click "Kick source now!" to kick source:</font><br>

<form method="post" style="margin: 0px;">
<input type="hidden" name="id" value="<? echo $id?>">
<input type="checkbox" name="kick_all" value="true" checked style="border: 1px solid black;"><font size="1">Kick all sources</font><br>
<input type="password" name="password_kick" style="border: 1px solid black;">
<input type="submit" value=">> Kick source now!" name="send" style="border: 1px solid black;">
</form>

<hr width="100%" size="1" color="black" noshade>

<font size="1">&copy; 2006 by <a href="mailto:stationscript@gmx.net" style="color:black;">aintschie</a></font>

</body>

</html>
Attached Files
File Type: zip kicksource.zip (2.1 KB, 1152 views)
aintschy is offline   Reply With Quote
Old 9th March 2008, 00:03   #2
Novation
Senior Member
 
Join Date: Oct 2007
Posts: 102
Anyone managed to get this script working ?

it seems to get stuck on the login section, i think it mught have something to do with the following line but i could be wrong....

if($_SERVER['PHP_AUTH_USER'] != "$login_user" || $_SERVER['PHP_AUTH_PW'] != "$login_password") {
Novation is offline   Reply With Quote
Old 11th July 2009, 20:04   #3
powerjaminradio
Junior Member
 
Join Date: Jun 2009
Posts: 10
Send a message via AIM to powerjaminradio Send a message via MSN to powerjaminradio Send a message via Yahoo to powerjaminradio Send a message via Skype™ to powerjaminradio
Not working

When the user name is user and password is 1234 and when I change it to something else it stops working.

Can somone PLEASE tell me why?

DJ Mikey
powerjaminradio is offline   Reply With Quote
Old 13th July 2009, 19:01   #4
kdh
Member
 
Join Date: Nov 2008
Posts: 55
Send a message via AIM to kdh
I'll share my Perl Version for you guys. Its much simpler.

#!/usr/bin/perl
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent(Mozilla);
$pass="tranceistotallygay";
$host="localhost";
$port="8666";


my $response = $ua->get("http://$host:$port/admin.cgi?pass=$pass&mode=kicksrc");

if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}

That'll kick my live dj currently connected. Its not as robust as the above script but works well for me. hope it helps.
kdh is offline   Reply With Quote
Old 14th July 2009, 23:54   #5
cuddles71
Senior Member
 
Join Date: Oct 2008
Posts: 104
This kicks them from the DNAS, right? I'm really looking for something to kick them from sc_trans (the new beta is NICE!).
cuddles71 is offline   Reply With Quote
Old 16th July 2009, 05:15   #6
kdh
Member
 
Join Date: Nov 2008
Posts: 55
Send a message via AIM to kdh
yes, mine kicks them from the DNAS.. I only use the sc_trans as a media player. I intergrated VLC into my server so I can do mpg/flash video streaming. sorry I wasn't clear about how my script works. =)
kdh is offline   Reply With Quote
Old 16th July 2009, 17:52   #7
cuddles71
Senior Member
 
Join Date: Oct 2008
Posts: 104
That's okay. I have our resident codemonkey working on a way to kick from sc_trans, but it's taking time.
cuddles71 is offline   Reply With Quote
Old 2nd August 2009, 19:17   #8
powerjaminradio
Junior Member
 
Join Date: Jun 2009
Posts: 10
Send a message via AIM to powerjaminradio Send a message via MSN to powerjaminradio Send a message via Yahoo to powerjaminradio Send a message via Skype™ to powerjaminradio
I got it working (kick page)

Hi

For some really odd reason it wont work on my server ( http://eastsidehosting.com ) but its a shared server and I put it on my home server and it worked just fine. I am not sure WHY. Maybe someone has some insight why this is?

The only port I have open is port 80 for the web server.

If somone has a idea why this is working please let me know.

Michael
powerjaminradio is offline   Reply With Quote
Old 4th January 2010, 02:51   #9
powerjaminradio
Junior Member
 
Join Date: Jun 2009
Posts: 10
Send a message via AIM to powerjaminradio Send a message via MSN to powerjaminradio Send a message via Yahoo to powerjaminradio Send a message via Skype™ to powerjaminradio
Windows Media (audio) kick source

Do ANYONE know how to make a Windows Media (audio) kick source????

We have one for shoutcast but we cant find one for windows media streaming (audio)

Dose such thing exist???

Michael
powerjaminradio is offline   Reply With Quote
Old 4th January 2010, 10:27   #10
caraoge
Senior Member
 
caraoge's Avatar
 
Join Date: Dec 2003
Location: Saarland, Germany
Posts: 331
You can`t kick a source on a windows media server.
There are too many ways get your data here (push, get, file, rebroadcast,...)
caraoge is offline   Reply With Quote
Old 4th January 2010, 19:09   #11
caraoge
Senior Member
 
caraoge's Avatar
 
Join Date: Dec 2003
Location: Saarland, Germany
Posts: 331
Quote:
PM from powerjaminradio: I dont understand your post about you cant kick windows streaming
Windows Media Service is a professional application.
Its not designed to support DJs.
Its designed to get data from external sources like encoders (push or pull), directorys (files), multicast streams, or special playlists.
If you want to change an specific source, you have to delete the publishing point and create a new one with the same name.
You can`t do this via an script and listeners will be disconnected if you delete a publishing point.
caraoge is offline   Reply With Quote
Old 5th January 2010, 00:53   #12
powerjaminradio
Junior Member
 
Join Date: Jun 2009
Posts: 10
Send a message via AIM to powerjaminradio Send a message via MSN to powerjaminradio Send a message via Yahoo to powerjaminradio Send a message via Skype™ to powerjaminradio
Windows Media (audio) kick source

I've found a service that dose what I wanted done. Thay are in the UK but thay have US servers.

http://streamsolutions.co.uk

I would even say thay have GREAT prices
powerjaminradio is offline   Reply With Quote
Old 5th January 2010, 06:10   #13
Nick@ss
Moderator
 
Nick@ss's Avatar
 
Join Date: Nov 2004
Location: Streamsolutions Headquarters
Posts: 11,956
Quote:
Originally posted by caraoge
Windows Media Service is a professional application.
Its not designed to support DJs.
Its designed to get data from external sources like encoders (push or pull), directorys (files), multicast streams, or special playlists.
If you want to change an specific source, you have to delete the publishing point and create a new one with the same name.
You can`t do this via an script and listeners will be disconnected if you delete a publishing point.
Just to clarify you can do all these things with a windows media server like kick source and also dj source switching.

This with now playing stats makes windows a viable option for dj use

but this is a shoutcast forum and not a windows media forum
Nick@ss is offline   Reply With Quote
Old 5th January 2010, 06:19   #14
powerjaminradio
Junior Member
 
Join Date: Jun 2009
Posts: 10
Send a message via AIM to powerjaminradio Send a message via MSN to powerjaminradio Send a message via Yahoo to powerjaminradio Send a message via Skype™ to powerjaminradio
Windows Media (audio) kick source

Well well I couldn't FIND a windows media forum
powerjaminradio is offline   Reply With Quote
Old 5th January 2010, 06:23   #15
Nick@ss
Moderator
 
Nick@ss's Avatar
 
Join Date: Nov 2004
Location: Streamsolutions Headquarters
Posts: 11,956
Thats why what we do is so "special"

Nick@ss is offline   Reply With Quote
Old 5th January 2010, 08:23   #16
caraoge
Senior Member
 
caraoge's Avatar
 
Join Date: Dec 2003
Location: Saarland, Germany
Posts: 331
Quote:
Originally posted by Nick@ss
Just to clarify you can do all these things with a windows media server like kick source and also dj source switching
DJ-Source is the same as a PUSH or PULL encoders ;-)
There aren't many programs you can use to stream music to a WMS-Server and everyone in this forum needs everything for free

Back to the roots ... this are SHOUTcast forums and nothing else...
caraoge is offline   Reply With Quote
Old 5th January 2010, 22:54   #17
Nick@ss
Moderator
 
Nick@ss's Avatar
 
Join Date: Nov 2004
Location: Streamsolutions Headquarters
Posts: 11,956
Quote:
Originally posted by caraoge
DJ-Source is the same as a PUSH or PULL encoders ;-)
There aren't many programs you can use to stream music to a WMS-Server and everyone in this forum needs everything for free

Back to the roots ... this are SHOUTcast forums and nothing else...
shoutcast and flash and windows and icecast and scripts and stats and wifi streamers and itunes and free and and and ......

LOL
Nick@ss is offline   Reply With Quote
Old 12th August 2011, 21:37   #18
j4ym4n
Junior Member
 
Join Date: Aug 2011
Posts: 1
anyone ever get this working?
j4ym4n is offline   Reply With Quote
Old 21st August 2011, 07:04   #19
Dhol
Junior Member
 
Join Date: May 2011
Posts: 22
thank you so much its working fine some time orginal kick system say busy try 4 sec but with this script problem solved thanks we are working everyday it
Dhol is offline   Reply With Quote
Reply
Go Back   Winamp Forums > SHOUTcast > SHOUTcast Discussions

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