[xiph-commits] r10036 - in icecast/trunk: . icecast_auth icecast_auth/images

oddsock at svn.xiph.org oddsock at svn.xiph.org
Thu Sep 22 06:40:02 PDT 2005


Author: oddsock
Date: 2005-09-22 06:39:55 -0700 (Thu, 22 Sep 2005)
New Revision: 10036

Added:
   icecast/trunk/icecast_auth/
   icecast/trunk/icecast_auth/COPYING
   icecast/trunk/icecast_auth/Makefile.am
   icecast/trunk/icecast_auth/README
   icecast/trunk/icecast_auth/action.php
   icecast/trunk/icecast_auth/adduser.php
   icecast/trunk/icecast_auth/config.php
   icecast/trunk/icecast_auth/configure.ac
   icecast/trunk/icecast_auth/db.php
   icecast/trunk/icecast_auth/deletemount.php
   icecast/trunk/icecast_auth/edituser.php
   icecast/trunk/icecast_auth/error.php
   icecast/trunk/icecast_auth/footer.php
   icecast/trunk/icecast_auth/header.php
   icecast/trunk/icecast_auth/icecast_auth.sql
   icecast/trunk/icecast_auth/images/
   icecast/trunk/icecast_auth/images/blue.png
   icecast/trunk/icecast_auth/images/corner_bottomleft.jpg
   icecast/trunk/icecast_auth/images/corner_bottomleft.png
   icecast/trunk/icecast_auth/images/corner_bottomright.jpg
   icecast/trunk/icecast_auth/images/corner_bottomright.png
   icecast/trunk/icecast_auth/images/corner_topleft.jpg
   icecast/trunk/icecast_auth/images/corner_topleft.png
   icecast/trunk/icecast_auth/images/corner_topright.jpg
   icecast/trunk/icecast_auth/images/corner_topright.png
   icecast/trunk/icecast_auth/images/custom_corners_bottomleft.gif
   icecast/trunk/icecast_auth/images/custom_corners_bottomleft.png
   icecast/trunk/icecast_auth/images/custom_corners_bottomright.gif
   icecast/trunk/icecast_auth/images/custom_corners_bottomright.png
   icecast/trunk/icecast_auth/images/custom_corners_rightborder.gif
   icecast/trunk/icecast_auth/images/custom_corners_rightborder.png
   icecast/trunk/icecast_auth/images/custom_corners_topleft.gif
   icecast/trunk/icecast_auth/images/custom_corners_topleft.png
   icecast/trunk/icecast_auth/images/custom_corners_topleft2.png
   icecast/trunk/icecast_auth/images/custom_corners_topright.gif
   icecast/trunk/icecast_auth/images/custom_corners_topright.png
   icecast/trunk/icecast_auth/images/icecast.png
   icecast/trunk/icecast_auth/images/icecast_logo.gif
   icecast/trunk/icecast_auth/index.php
   icecast/trunk/icecast_auth/info.php
   icecast/trunk/icecast_auth/listusers.php
   icecast/trunk/icecast_auth/login.php
   icecast/trunk/icecast_auth/logout.php
   icecast/trunk/icecast_auth/main.php
   icecast/trunk/icecast_auth/mountpoints.php
   icecast/trunk/icecast_auth/reports.php
   icecast/trunk/icecast_auth/style.css
   icecast/trunk/icecast_auth/testauth.php
Log:
initial import of php authentication application for icecast


Added: icecast/trunk/icecast_auth/COPYING
===================================================================
--- icecast/trunk/icecast_auth/COPYING	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/COPYING	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: icecast/trunk/icecast_auth/Makefile.am
===================================================================
--- icecast/trunk/icecast_auth/Makefile.am	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/Makefile.am	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,29 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = 1.6 foreign dist-zip
+
+EXTRA_DIST = \
+				action.php \
+				adduser.php \
+				config.php \
+				COPYING \
+				db.php \
+				deletemount.php \
+				edituser.php \
+				error.php \
+				footer.php \
+				header.php \
+				icecast_auth.sql \
+				images \
+				index.php \
+				info.php \
+				listusers.php \
+				login.php \
+				logout.php \
+				main.php \
+				mountpoints.php \
+				README \
+				reports.php \
+				style.css \
+				testauth.php
+

Added: icecast/trunk/icecast_auth/README
===================================================================
--- icecast/trunk/icecast_auth/README	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/README	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,65 @@
+icecast_auth - README
+---------------------------------------------------------------------
+
+This is a fairly simple application created to show off some of the
+capabilities of icecast's url authenticator.  It's a set of PHP scripts
+for setting up and managing a simple subscription-based stream or set
+of streams.  I tried to include as much functionality as I could,
+without going overboard.  If you are finding that it doesn't have the
+features you need, then by all means, enhance it and share it with
+the community. 
+
+icecast_auth is distributed under the GNU GPL, version 2. A copy of this
+license is included with this software in the COPYING file.
+
+Prerequisites
+---------------------------------------------------------------------
+
+* php - I'm not much of a php'er, so I think php4 is required, but don't
+        quote me on that.
+* mysql - you need this to store your users and mountpoints.
+
+Setup
+---------------------------------------------------------------------
+You'll need to first create your database and tables needed by the
+scripts.  There is an icecast_auth.sql script in the distribution which
+has all the table definitions. You'll need to run it using something
+like phpmyAdmin.
+
+Edit and change the info in config.php.  The admin user/pass is what
+you will be logging in with.  The rest is info needed to connect to 
+whatever mysql db you have setup.
+
+Hit the main index.php page and login using the admin user/pass.
+
+You'll need to add mountpoints for each of your streams that you want
+to secure with the url authenticator, and then add your users one by one.
+Want a batch uploader ? Did I mention that this was a *simple* application ?
+
+I've included some reports that you can use for seeing what is going on,
+when your mounts are connecting/disconnecting, what your listeners are doing,
+how long they are doing it...yadda-yadda...
+
+Configuring your Icecast server to use it
+---------------------------------------------------------------------
+
+This part is pretty simple, you need to create a "mount specific" option 
+as such :
+
+<mount>
+	<mount-name>/stream.ogg</mount-name>
+	<authentication type="url">
+		<option name="add"    value="http://myauthserver.com/icecast_auth/action.php"/>
+		<option name="remove" value="http://myauthserver.com/icecast_auth/action.php"/>
+		<option name="start" value="http://myauthserver.com/icecast_auth/action.php"/>
+		<option name="end" value="http://myauthserver.com/icecast_auth/action.php"/>
+	</authentication>
+</mount>
+
+All actions (add, remove, start, and end) are handled by the single action.php script.
+
+You will need to explicitly name each mountpoint you want secured.  If you need more
+help than this, check out the icecast main documentation.
+
+
+- created by oddsock

Added: icecast/trunk/icecast_auth/action.php
===================================================================
--- icecast/trunk/icecast_auth/action.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/action.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,229 @@
+<? 
+include "config.php";
+include "db.php";
+?>
+<?
+	$db = new DB($mysql_host, $mysql_user, $mysql_password, $mysql_db);
+?>
+<?
+
+$mount = "";
+$username = "";
+$password = "";
+$action = "";
+$server = "";
+$port = "";
+$duration = "";
+
+$listener_add = "listener_add";
+$listener_remove = "listener_remove";
+$mount_add = "mount_add";
+$mount_remove = "mount_remove";
+
+function insertAudit($db, $user, $server, $mount, $action) {
+	global $table_prefix;
+	$query = "insert into ".$table_prefix."audit (datestamp, username, server, mountpoint, action) values (NOW(), '".mysql_real_escape_string($user)."', '".mysql_real_escape_string($server)."', '".mysql_real_escape_string($mount)."', '".mysql_real_escape_string($action)."')";
+	mysql_query($query, $db->link);
+}
+
+if (isset($_REQUEST["server"])) {
+	$server=$_REQUEST["server"];
+}
+if (isset($_REQUEST["port"])) {
+	$port=$_REQUEST["port"];
+}
+
+$servertext = "";
+if (($server != "") && ($port != "")) {
+	$servertext = "$server:$port";
+}
+if (isset($_REQUEST["duration"])) {
+	$duration=$_REQUEST["duration"];
+}
+if (isset($_REQUEST["action"])) {
+	$action=$_REQUEST["action"];
+}
+else {
+	header('icecast-auth-user: 0');
+	header('icecast-auth-message: action not supplied');
+	exit;
+}
+
+if (isset($_REQUEST["mount"])) {
+	$mount=$_REQUEST["mount"];
+}
+else {
+	header('Response: 0');
+	header('ResponseMessage: mount not supplied');
+	exit;
+}
+
+if (isset($_REQUEST["user"])) {
+	$username=$_REQUEST["user"];
+}
+else {
+	if (($action == $listener_add) || ($action == $listener_remove)) {
+		header('icecast-auth-user: 0');
+		header('icecast-auth-message: username not supplied');
+		exit;
+	}
+}
+
+if (isset($_REQUEST["pass"])) {
+	$password=$_REQUEST["pass"];
+}
+else {
+	if (($action == $listener_add) || ($action == $listener_remove)) {
+		header('icecast-auth-user: 0');
+		header('icecast-auth-message: password not supplied');
+		exit;
+	}
+}
+
+
+if ($action == $listener_add) {
+	$query = "select password, timeleft from ".$table_prefix."users where mountpoint = '".mysql_real_escape_string($mount)."' and username = '".mysql_real_escape_string($username)."'";
+	$result = mysql_query($query, $db->link);
+	$row = mysql_fetch_assoc($result);
+	if ($row) {
+		$pass = $row['password'];
+		$time = (int)$row['timeleft'];
+		if ($pass == $password) {
+			if ($time != -1) {
+				if ($time == 0) {
+					header('icecast-auth-user: 0');
+					header('icecast-auth-message: all time expired');
+					//insertAudit($db, $username, $servertext, $mount, "Failed Auth - time expired");
+					exit;
+				}
+				else {
+					header('icecast-auth-user: 1');
+					header('icecast-auth-message: OK');
+					header("icecast-auth-timelimit: $time");
+					insertAudit($db, $username, $servertext, $mount, "Listen Start - timelimit $time");
+					exit;
+				}
+			}
+			else {
+				header('icecast-auth-user: 1');
+				header('icecast-auth-message: OK');
+				insertAudit($db, $username, $servertext, $mount, "Listen Start");
+				exit;
+			}
+		}
+		else {
+			header('icecast-auth-user: 0');
+			header('icecast-auth-message: invalid password');
+			//insertAudit($db, $username, $servertext, $mount, "Failed Auth - invalid password");
+			exit;
+		}
+	}
+	else {
+		$query = "select password, timeleft from ".$table_prefix."users where mountpoint = 'ALL' and username = '".mysql_real_escape_string($username)."'";
+		$result = mysql_query($query, $db->link);
+		$row = mysql_fetch_assoc($result);
+		if ($row) {
+			$pass = $row['password'];
+			$time = 0;
+			$time = $row['timeleft'];
+			if ($pass == $password) {
+				if ($time != -1) {
+					if ($time == 0) {
+						header('icecast-auth-user: 0');
+						header('icecast-auth-message: all time expired');
+						//insertAudit($db, $username, $servertext, $mount, "Failed Auth - time expired");
+						exit;
+					}
+					else {
+						header('icecast-auth-user: 1');
+						header('icecast-auth-message: OK');
+						header("icecast-auth-timelimit: $time");
+						insertAudit($db, $username, $servertext, $mount, "Listen Start - timelimit $time");
+						exit;
+					}
+				}
+				else {
+					header('icecast-auth-user: 1');
+					header('icecast-auth-message: OK');
+					insertAudit($db, $username, $servertext, $mount, "Listen Start");
+					exit;
+				}
+			}
+			else {
+				header('icecast-auth-user: 0');
+				header('icecast-auth-message: invalid password');
+				//insertAudit($db, $username, $servertext, $mount, "Failed Auth - invalid password");
+				exit;
+			}
+		}
+		else {
+			header('icecast-auth-user: 0');
+			header('icecast-auth-message: invalid user');
+			//insertAudit($db, $username, $servertext, $mount, "Failed Auth - invalid user");
+			exit;
+		}
+	}
+}
+if ($action == $listener_remove) {
+
+	if ($duration == "") {
+		header('icecast-auth-user: 0');
+		header('icecast-auth-message: missing duration');
+		insertAudit($db, $username, $servertext, $mount, "Listener Remove");
+		exit;
+	}
+	$timespentlistening = 0;
+	$timespentlistening = (int)$duration;
+
+	$query = "select timeleft from ".$table_prefix."users where mountpoint = '".mysql_real_escape_string($mount)."' and username = '".mysql_real_escape_string($username)."'";
+	$result = mysql_query($query, $db->link);
+	$row = mysql_fetch_assoc($result);
+	if ($row) {
+		$time = 0;
+		$time = (int)$row['timeleft'];
+		$timeremaining = $time - $timespentlistening;
+		if ($timeremaining < 0) {
+			$timeremaining = 0;
+		}
+		if ($time == -1) {
+			$timeremaining = -1;
+		}
+		$query2 = "update ".$table_prefix."users set timeleft = $timeremaining where mountpoint = '".mysql_real_escape_string($mount)."' and username = '".mysql_real_escape_string($username)."'";
+		$result2 = mysql_query($query2, $db->link);
+		insertAudit($db, $username, $servertext, $mount, "Listener Remove ($duration secs)");
+	}
+	else {
+		$query = "select timeleft from ".$table_prefix."users where mountpoint = 'ALL' and username = '".mysql_real_escape_string($username)."'";
+		$result = mysql_query($query, $db->link);
+		$row = mysql_fetch_assoc($result);
+		if ($row) {
+			$time = 0;
+			$time = (int)$row['timeleft'];
+			$timeremaining = $time - $timespentlistening;
+			if ($timeremaining < 0) {
+				$timeremaining = 0;
+			}
+			if ($time == -1) {
+				$timeremaining = -1;
+			}
+			$query2 = "update ".$table_prefix."users set timeleft = $timeremaining where mountpoint = 'ALL' and username = '".mysql_real_escape_string($username)."'";
+			$result2 = mysql_query($query2, $db->link);
+			insertAudit($db, $username, $servertext, $mount, "Listener Remove ($duration secs)");
+		}
+		else {
+			header('icecast-auth-user: 0');
+			header('icecast-auth-message: invalid user');
+			//insertAudit($db, $username, $servertext, $mount, "Failed Listener Remove - invalid user");
+			exit;
+		}
+	}
+}
+if ($action == $mount_add) {
+	insertAudit($db, "", $servertext, $mount, "Mount connect");
+	header('icecast-auth-message: OK');
+}
+if ($action == $mount_remove) {
+	insertAudit($db, "", $servertext, $mount, "Mount disconnect");
+	header('icecast-auth-message: OK');
+}
+?>

Added: icecast/trunk/icecast_auth/adduser.php
===================================================================
--- icecast/trunk/icecast_auth/adduser.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/adduser.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,128 @@
+<? include "header.php"; ?>
+<? include "db.php"; ?>
+<?
+	$db = new DB($mysql_host, $mysql_user, $mysql_password, $mysql_db);
+?>
+<h2>Add User</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<p>
+<?
+
+$doAdd = true;
+$username = "";
+if (isset($_REQUEST["username"])) {
+	$username=$_REQUEST["username"];
+}
+$password = "";
+if (isset($_REQUEST["password"])) {
+	$password=$_REQUEST["password"];
+}
+$email = "";
+if (isset($_REQUEST["email"])) {
+	$email=$_REQUEST["email"];
+}
+$timelimit = "";
+if (isset($_REQUEST["timelimit"])) {
+	$timelimit=$_REQUEST["timelimit"];
+}
+$mount = "";
+if (isset($_REQUEST["mount"])) {
+	$mount=$_REQUEST["mount"];
+}
+$confirm = "";
+if (isset($_REQUEST["confirm"])) {
+	$confirm=$_REQUEST["confirm"];
+}
+
+if (($username != "") && ($password != "") && ($mount != "")) {
+	$doAdd = true;
+}
+else {
+	$doAdd = false;
+}
+
+if (($confirm == "1") && ($doAdd == false)) {
+	echo "<font color=red>Required field missing</font><br>";
+}
+
+$displayform = true;
+
+if ($doAdd) {
+	if ($timelimit == "") {
+		$timelimit = "-1";
+	}
+	$query = sprintf("insert into ".$table_prefix."users (username, password, mountpoint, email, timeleft) values ('%s', '%s', '%s', '%s', %s)",  
+			mysql_real_escape_string($username),
+			mysql_real_escape_string($password),
+			mysql_real_escape_string($mount),
+			mysql_real_escape_string($email),
+			$timelimit);
+			
+	if (mysql_query($query, $db->link)) {
+		echo "<i>Added User $username</i><br>";
+	}
+	else {
+		echo "<font color=red>Error adding user $username : ".mysql_error()."</font><br>";
+	}
+	
+}
+
+?>
+<?
+if ($displayform) {
+	if ($mount == "") {
+		$allselected = "selected";
+	}
+	else {
+		$allselected = "";
+	}
+?>
+<form method=GET action="adduser.php">
+<input type=hidden name="confirm" value="1">
+<table border=0>
+<tr>
+<td>Mountpoint:</td>
+<td> 
+<select name="mount">
+<option value='ALL' <? echo $allselected; ?>>All Mountpoints
+<?
+$query = "select mountpoint_name from ".$table_prefix."mountpoints";
+$result = mysql_query($query, $db->link);
+while ($row = mysql_fetch_assoc($result)) {
+	$availablemount = $row['mountpoint_name'];
+	if ($availablemount == $mount) {
+   		$selected = "selected";
+   	}
+   	else {
+   		$selected = "";
+   	}
+	echo "<option value='$availablemount' $selected >$availablemount";
+}
+mysql_free_result($result);
+?>
+</select>
+</td></tr>
+<tr><td>Username</td><td><input type="text" name="username" size="15"></td></tr>
+<tr><td>Password</td><td><input type="text" name="password" size="15"></td></tr>
+<tr><td>E-mail</td><td><input type="text" name="email" size="15"></td></tr>
+<tr><td>Time Restriction (in seconds)</td><td><input type="text" name="timelimit" size="15"></td></tr>
+</table>
+<br>
+<br>
+<input type="Submit" value="Add User">
+</form>
+</p>
+<?
+}
+?>
+	<br>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/config.php
===================================================================
--- icecast/trunk/icecast_auth/config.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/config.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,11 @@
+<?
+$adminUser = 'admin';
+$adminPassword = 'hackme';
+
+$mysql_db = 'icecast_auth';
+$mysql_user = '';
+$mysql_password = '';
+$mysql_host = 'localhost';
+
+$table_prefix = 'icecastauth_';
+?>

Added: icecast/trunk/icecast_auth/configure.ac
===================================================================
--- icecast/trunk/icecast_auth/configure.ac	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/configure.ac	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,5 @@
+AC_PREREQ(2.57)
+AC_INIT(icecast_auth,1.0)
+AM_INIT_AUTOMAKE([dist-bzip2])
+AC_OUTPUT(Makefile)
+

Added: icecast/trunk/icecast_auth/db.php
===================================================================
--- icecast/trunk/icecast_auth/db.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/db.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,16 @@
+<?php
+class DB {
+	function DB($ihost, $iuser, $ipass, $idb) {
+		$this->host = $ihost;
+		$this->db = $idb;
+		$this->user = $iuser;
+		$this->pass = $ipass;
+		$this->link = mysql_connect($this->host, $this->user, $this->pass);
+		mysql_select_db($this->db);
+		register_shutdown_function(array( &$this, "closedb" ));
+	}
+	function closedb() {
+		mysql_close($this->link);
+	}
+}
+?>
\ No newline at end of file

Added: icecast/trunk/icecast_auth/deletemount.php
===================================================================
--- icecast/trunk/icecast_auth/deletemount.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/deletemount.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,93 @@
+<? include "header.php"; ?>
+<? include "db.php"; ?>
+<?
+	$db = new DB($mysql_host, $mysql_user, $mysql_password, $mysql_db);
+?>
+<h2>Delete Mountpoint</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<p>
+<?
+
+$reassign = "";
+if (isset($_REQUEST["reassign"])) {
+	$reassign=$_REQUEST["reassign"];
+}
+
+$displayform = true;
+if (isset($_REQUEST["mount"])) {
+	$mount=$_REQUEST["mount"];
+	if (isset($_REQUEST["confirm"])) {
+		$confirm=$_REQUEST["confirm"];
+		if ($confirm == "1") {
+			$displayform = false;
+			
+			$query = sprintf("delete from ".$table_prefix."mountpoints where mountpoint_name = '%s'",  mysql_real_escape_string($mount));
+			if (mysql_query($query, $db->link)) {
+				echo "<i>Deleted mountpoint $mount</i><br>";
+			}
+			else {
+				echo "<font color=red>Error deleting mountpoint $mount : ".mysql_error()."</font><br>";
+			}
+			if ($reassign != '') {
+				$query = sprintf("update users set ".$table_prefix."mountpoint = '%s' where mountpoint = '%s'",  mysql_real_escape_string($reassign), mysql_real_escape_string($mount));
+				$result = mysql_query($query, $db->link);
+				if (!$result) {
+					echo "<font color=red>Error reassigning users from $mount to $reassign : ".mysql_error()."</font><br>";
+				}
+				else {
+					$users_updated = mysql_affected_rows();
+					echo "<i> $users_updated users re-assigned from $mount to mountpoint $reassign</i><br>";
+				}
+			}			
+			else {
+				echo "<i> No users re-assigned.</i><br>";
+			}
+		}
+	}
+}
+?>
+<?
+if ($displayform) {
+?>
+This will delete the mountpoint <? echo $mount; ?> and optionally re-assign all users subscribed to this mountpoint to another mountpoint
+</p>
+<p>
+<font color=red>THIS WILL REMOVE THE MOUNTPOINT. PLEASE MAKE SURE YOU WANT TO DO THIS.</font>
+</p>
+<p>
+Delete <? echo $mount; ?><br>
+<form method=GET action="deletemount.php">
+<input type=hidden name="confirm" value="1">
+<input type=hidden name="mount" value="<? echo "$mount"; ?>">
+Re-assign to mountpoint: 
+<select name="reassign">
+<option value='' selected>Do not reassign
+<?
+$query = "select ".$table_prefix."mountpoint_name from mountpoints";
+$result = mysql_query($query, $db->link);
+while ($row = mysql_fetch_assoc($result)) {
+   $mount = $row['mountpoint_name'];
+	echo "<option value='$mount'>$mount";
+}
+mysql_free_result($result);
+?>
+</select>
+<br>
+<br>
+<input type="Submit" value="Delete">
+</form>
+</p>
+<?
+}
+?>
+	<br>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/edituser.php
===================================================================
--- icecast/trunk/icecast_auth/edituser.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/edituser.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,115 @@
+<? include "header.php"; ?>
+<? include "db.php"; ?>
+<?
+	$db = new DB($mysql_host, $mysql_user, $mysql_password, $mysql_db);
+?>
+<h2>Edit User</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<p>
+<?
+
+$doEdit = true;
+$username = "";
+if (isset($_REQUEST["username"])) {
+	$username=$_REQUEST["username"];
+}
+$password = "";
+if (isset($_REQUEST["password"])) {
+	$password=$_REQUEST["password"];
+}
+$email = "";
+if (isset($_REQUEST["email"])) {
+	$email=$_REQUEST["email"];
+}
+$timelimit = "";
+if (isset($_REQUEST["timelimit"])) {
+	$timelimit=$_REQUEST["timelimit"];
+}
+$mount = "";
+if (isset($_REQUEST["mount"])) {
+	$mount=$_REQUEST["mount"];
+}
+$confirm = "";
+if (isset($_REQUEST["confirm"])) {
+	$confirm=$_REQUEST["confirm"];
+}
+
+if (($username != "") && ($password != "") && ($mount != "")) {
+	$doEdit = true;
+}
+else {
+	$doEdit = false;
+}
+
+if (($confirm == "1") && ($doEdit == false)) {
+	echo "<font color=red>Required field missing</font><br>";
+}
+
+$displayform = true;
+
+if ($doEdit) {
+	if ($timelimit == "") {
+		$timelimit = "-1";
+	}
+	$query = sprintf("update ".$table_prefix."users set password = '%s', email = '%s', timeleft = %s where username = '%s' and mountpoint = '%s'",  
+			mysql_real_escape_string($password),
+			mysql_real_escape_string($email),
+			mysql_real_escape_string($timelimit),
+			mysql_real_escape_string($username),
+			mysql_real_escape_string($mount));
+			
+	if (mysql_query($query, $db->link)) {
+		echo "<i>User $username updated</i><br>";
+		$displayform = false;
+	}
+	else {
+		echo "<font color=red>Error updating user $username : ".mysql_error()."</font><br>";
+		$displayform = false;
+	}
+	
+}
+
+?>
+<?
+if ($displayform) {
+?>
+<form method=GET action="edituser.php">
+<input type=hidden name="confirm" value="1">
+<table border=0>
+<?
+$query = "select username, password, email, timeleft, mountpoint from ".$table_prefix."users where mountpoint = '".mysql_real_escape_string($mount)."' and username = '".mysql_real_escape_string($username)."'";
+$result = mysql_query($query, $db->link);
+while ($row = mysql_fetch_assoc($result)) {
+	$username = $row['username'];
+	$password = $row['password'];
+	$email = $row['email'];
+	$timeleft = $row['timeleft'];
+	$mountpoint = $row['mountpoint'];
+	echo '<tr><td>Username</td><td><input type="hidden" name="username" size="15" value="'.$username.'">'.$username.' - Check <a href="reports.php?username='.urlencode($username).'">User Report</a></td></tr>';
+	echo '<tr><td>Mountpoint</td><td><input type="hidden" name="mount" size="15" value="'.$mount.'">'.$mount.'</td></tr>';
+	echo '<tr><td>Password</td><td><input type="text" name="password" size="15" value="'.$password.'"></td></tr>';
+	echo '<tr><td>E-mail</td><td><input type="text" name="email" size="25" value="'.$email.'"></td></tr>';
+	echo '<tr><td>Time Restriction (in seconds)</td><td><input type="text" name="timelimit" size="15" value="'.$timeleft.'"> ***Enter -1 for no time restrictions.</td></tr>';
+}
+?>	
+</table>
+<br>
+<br>
+<input type="hidden" name="mount" value="<? echo $mount; ?>">
+<input type="Submit" value="Edit User">
+</form>
+</p>
+<?
+}
+?>
+	<br>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/error.php
===================================================================
--- icecast/trunk/icecast_auth/error.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/error.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,26 @@
+<? include "header.php"; ?>
+<h2>Error</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<p>
+	<br><font color="red">
+<?
+	$errorCode = $_REQUEST['errorCode'];
+	if ($errorCode == 1) {
+		$errorMessage = "Invalid username or password";
+	}
+	echo "$errorMessage";
+?>
+	</font>
+	<br>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>
+</div>
+<? include "footer.php"; ?>
\ No newline at end of file

Added: icecast/trunk/icecast_auth/footer.php
===================================================================
--- icecast/trunk/icecast_auth/footer.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/footer.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,5 @@
+</td><td width=50></td></tr>
+</table>
+<br><br><br>
+</body>
+</html>

Added: icecast/trunk/icecast_auth/header.php
===================================================================
--- icecast/trunk/icecast_auth/header.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/header.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,49 @@
+<?
+  include "config.php";
+  session_start();
+
+  $currentPage = basename($_SERVER['PHP_SELF']);
+  if (($currentPage != "login.php") && ($currentPage != "error.php")) {
+	  if (!isset($_SESSION['loggedin'])) {
+		  header("Location: login.php");
+	  }
+  }
+
+?>
+  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>Icecast Authentication Manager</title>
+<link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+<body bgcolor="black">
+<img src="images/icecast_logo.gif" align="middle"><font face="verdana" size=5 color="white">Iceast Authentication Manager</font>
+<table width="100%" border=0 cellpadding=0 cellspacing=0 bgcolor=black>
+<tr><td colspan=3 bgcolor="#7B96C6" height=3><img alt="Icecast Logo" src="images/blue.png" height=3></td></tr>
+<tr>
+<td colspan=3 bgcolor="black">
+	<table border=0 cellpadding=1 cellspacing=3 width="90%">
+	<tr>
+	    <td align=left >
+	    <table width=100% border=0 cellpadding=0 cellspacing=0>
+	    <tr><td><a class="nav" href="index.php">Home</a>&nbsp;&nbsp;|&nbsp;&nbsp;
+	    <a class="nav" href="mountpoints.php">Mountpoints</a>&nbsp;&nbsp;|&nbsp;&nbsp;
+	    <a class="nav" href="adduser.php">Add User</a>&nbsp;&nbsp;|&nbsp;&nbsp;
+	    <a class="nav" href="reports.php">Reports</a>&nbsp;&nbsp;|&nbsp;&nbsp;
+	    <a class="nav" href="info.php">Info</a>&nbsp;&nbsp;|&nbsp;&nbsp;
+	    <a class="nav" href="logout.php">Logout</a>
+	    </td>
+	    <td align=right>
+	    <form method=GET action="listusers.php">Search for a user : <input type="text" name="username" size="15"><input type="Submit" value="Search"></form>
+	    </td></tr>
+	    </table>
+	    </td></tr>
+	</table>
+</td></tr>
+<tr><td colspan=3 bgcolor="#7B96C6" height=3><img alt="Icecast Logo" src="images/blue.png" height=3></td></tr>
+<tr><td colspan=3><br><br></td></tr>
+<tr>
+<td width=50><br></td>
+<td>
+

Added: icecast/trunk/icecast_auth/icecast_auth.sql
===================================================================
--- icecast/trunk/icecast_auth/icecast_auth.sql	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/icecast_auth.sql	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,43 @@
+CREATE TABLE icecastauth_audit (
+  datestamp datetime default NULL,
+  username varchar(50) NOT NULL default '',
+  server varchar(255) NOT NULL default '',
+  mountpoint varchar(100) NOT NULL default '',
+  action varchar(255) NOT NULL default ''
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `listen_detail`
+--
+
+CREATE TABLE icecastauth_listen_detail (
+  username varchar(50) NOT NULL default '',
+  datestamp datetime NOT NULL default '0000-00-00 00:00:00',
+  server varchar(255) NOT NULL default '',
+  mountpoint varchar(100) NOT NULL default '',
+  time_spent_listening bigint(20) NOT NULL default '0',
+  PRIMARY KEY  (username,datestamp,mountpoint)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `mountpoints`
+--
+
+CREATE TABLE icecastauth_mountpoints (
+  mountpoint_name varchar(100) NOT NULL default '',
+  PRIMARY KEY  (mountpoint_name)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `users`
+--
+
+CREATE TABLE icecastauth_users (
+  username varchar(50) NOT NULL default '',
+  password varchar(255) NOT NULL default '',
+  mountpoint varchar(100) NOT NULL default '',
+  email varchar(255) default NULL,
+  timeleft bigint(20) default NULL,
+  PRIMARY KEY  (username,mountpoint)
+) TYPE=MyISAM;
+

Added: icecast/trunk/icecast_auth/images/blue.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/blue.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_bottomleft.jpg
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_bottomleft.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_bottomleft.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_bottomleft.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_bottomright.jpg
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_bottomright.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_bottomright.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_bottomright.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_topleft.jpg
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_topleft.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_topleft.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_topleft.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_topright.jpg
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_topright.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/corner_topright.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/corner_topright.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_bottomleft.gif
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_bottomleft.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_bottomleft.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_bottomleft.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_bottomright.gif
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_bottomright.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_bottomright.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_bottomright.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_rightborder.gif
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_rightborder.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_rightborder.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_rightborder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_topleft.gif
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_topleft.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_topleft.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_topleft.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_topleft2.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_topleft2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_topright.gif
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_topright.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/custom_corners_topright.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/custom_corners_topright.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/icecast.png
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/icecast.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/images/icecast_logo.gif
===================================================================
(Binary files differ)


Property changes on: icecast/trunk/icecast_auth/images/icecast_logo.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: icecast/trunk/icecast_auth/index.php
===================================================================
--- icecast/trunk/icecast_auth/index.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/index.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,20 @@
+<? include "header.php"; ?>
+<h2>Welcome</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<h3>Welcome</h3>
+<p>
+You are successfully logged in.  Please use the top navigation bar to see all the features of the application.
+	<br>
+	<br>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/info.php
===================================================================
--- icecast/trunk/icecast_auth/info.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/info.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,39 @@
+<? include "header.php"; ?>
+<h2>Info</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+
+<h3>About</h3>
+<p>
+The Icecast Authentication Manager was written as a demo app that can be used in conjunction with
+icecast's URL-based authenticator.  It was written to showcase the kind of thing that can be done
+with the authenticator, but is by no means intended to be a complete application.  It's all written
+in PHP and uses mySQL as a database store.  If you would like to extend it or expand on the features
+please share those with the community at large.
+</p>
+<p>
+<font color=yellow>
+- oddsock
+	<br>
+	<br>
+<h3>README</h3>
+<pre>
+<p>
+<? $readme = file_get_contents("README");
+   $readme = str_replace("<", "&lt;", $readme);
+   $readme = str_replace(">", "&gt;", $readme);
+   print $readme;
+ ?>
+</p>
+</pre>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/listusers.php
===================================================================
--- icecast/trunk/icecast_auth/listusers.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/listusers.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,61 @@
+<? include "header.php"; ?>
+<? include "db.php"; ?>
+<?
+	$db = new DB($mysql_host, $mysql_user, $mysql_password, $mysql_db);
+?>
+<?
+
+$mount = "";
+
+if (isset($_REQUEST["mount"])) {
+	$mount=$_REQUEST["mount"];
+}
+$username = "";
+
+if (isset($_REQUEST["username"])) {
+	$username=$_REQUEST["username"];
+}
+
+?>
+<h2>Mountpoints</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<h3>Mountpoint Listing (<? echo $mount; ?>)</h3>
+<p>
+<table border=0 width=100%>
+<tr><td>Username</td><td>Email<td><td>Time Restrictions</td></tr>
+<?
+$query = "select username, email, timeleft, mountpoint from ".$table_prefix."users where mountpoint = '$mount' or mountpoint = 'ALL'";
+if ($username != "") {
+	$query = "select username, email, timeleft, mountpoint from ".$table_prefix."users where username like '%$username%'";
+}
+$result = mysql_query($query, $db->link);
+while ($row = mysql_fetch_assoc($result)) {
+	$username = $row['username'];
+	$email = $row['email'];
+	$timeleft = $row['timeleft'];
+	$mountpoint = $row['mountpoint'];
+	$timerestriction = "None";
+	if ($timeleft != "-1") {
+		$timerestriction = "$timeleft seconds";
+	}
+	$mountall = " ($mountpoint) ";
+	if ($mountpoint == "ALL") {
+		$mountall = " (All) ";
+	}
+	echo "<tr><td><a href='edituser.php?username=".urlencode($username)."&mount=".urlencode($mountpoint)."'>$username</a>$mountall</td><td>$email<td><td>$timerestriction</td></tr>";
+}
+mysql_free_result($result);
+?>
+</table>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/login.php
===================================================================
--- icecast/trunk/icecast_auth/login.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/login.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,58 @@
+<?
+include "config.php";
+
+$dologin = 0;
+$username = "";
+$password = "";
+if (isset($_REQUEST["dologin"]))
+	$dologin=$_REQUEST["dologin"];
+if (isset($_REQUEST["username"]))
+	$username=$_REQUEST["username"];
+if (isset($_REQUEST["password"]))
+	$password=$_REQUEST["password"];
+
+if ($dologin == 1) {
+	if (($adminPassword == $password) && ($adminUser == $username)) {
+		session_start();
+		$_SESSION['loggedin'] = 1;
+		header("Location: index.php");
+	}
+	else {
+		session_start();
+		session_destroy();
+		header("Location: error.php?errorCode=1");
+	}
+}
+include "header.php";
+?>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+
+<p>
+	<form method="post" action="login.php">
+		<input type="hidden" name="dologin" value="1">
+	<center>
+	<table border=1 width=50% bgcolor="#222222">
+		<tr><td><center>Login</center></td></tr>
+	</table>
+		<br>
+	<table border=0>
+		<tr><td>UserName</td><td><input type="text" name="username" size=20></tr>
+		<tr><td>Password</td><td><input type="password" name="password" size=20></tr>
+	</table>
+		<br><br>
+		<input type="submit" value="Login">
+   </center>
+	</form>
+	<br>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>
+</div>
+

Added: icecast/trunk/icecast_auth/logout.php
===================================================================
--- icecast/trunk/icecast_auth/logout.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/logout.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,5 @@
+<? 
+session_start();
+session_destroy();
+	header("Location: index.php");
+?>

Added: icecast/trunk/icecast_auth/main.php
===================================================================
--- icecast/trunk/icecast_auth/main.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/main.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,18 @@
+<h2>Login</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<h3>Welcome</h3>
+<p>
+	<br>
+	<br>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+

Added: icecast/trunk/icecast_auth/mountpoints.php
===================================================================
--- icecast/trunk/icecast_auth/mountpoints.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/mountpoints.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,68 @@
+<? include "header.php"; ?>
+<? include "db.php"; ?>
+<?
+	$db = new DB($mysql_host, $mysql_user, $mysql_password, $mysql_db);
+?>
+<h2>Mountpoints</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<h3>Mountpoint Listing</h3>
+<p>
+<?
+
+if (isset($_REQUEST["action"])) {
+	$action=$_REQUEST["action"];
+	if ($action == "add") {
+		if (isset($_REQUEST["mount"])) {
+			$mount=$_REQUEST["mount"];
+			if (!ereg("^/", $mount)) {
+				echo "<font color=red>Error adding mountpoint $mount : mountpoint must begin with a slash (/)</font><br>";
+			}
+			else {
+				$query = sprintf("insert into ".$table_prefix."mountpoints values ('%s')",  mysql_real_escape_string($mount));
+				if (mysql_query($query, $db->link)) {
+					echo "<i>Added mountpoint $mount</i><br>";
+				}
+				else {
+					echo "<font color=red>Error adding mountpoint $mount : ".mysql_error()."</font><br>";
+				}
+			}
+		}
+	}
+}
+
+?>
+<table border=0 width=100%>
+<?
+$query = "select mountpoint_name from ".$table_prefix."mountpoints";
+$result = mysql_query($query, $db->link);
+while ($row = mysql_fetch_assoc($result)) {
+   $mount = $row['mountpoint_name'];
+   $subquery = "select count(*) from ".$table_prefix."users where mountpoint = '$mount' or mountpoint = 'ALL'";
+   $subresult = mysql_query($subquery, $db->link);
+   $subrow = mysql_fetch_row($subresult);
+   mysql_free_result($subresult);
+   $usercount = $subrow[0];
+   
+   echo "<tr><td>$mount</td><td><a href='adduser.php?mount=".urlencode($mount)."'>Add user</a>&nbsp;&nbsp;&nbsp;<a href='listusers.php?mount=".urlencode($mount)."'>List users</a>&nbsp;<a href='reports.php?mount=".urlencode($mount)."'>Get Report</a></td><td>Users: $usercount<td><td><a href='deletemount.php?mount=$mount'>Delete</a></td></tr>";
+}
+mysql_free_result($result);
+?>
+</table>
+	<br>
+<form method=GET action="mountpoints.php">
+<input type=hidden name="action" value="add">
+Add new mountpoint <input type=text name="mount" size=20>&nbsp;&nbsp;<input type="submit" value="Add">
+</form>
+	<br>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/reports.php
===================================================================
--- icecast/trunk/icecast_auth/reports.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/reports.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,204 @@
+<? include "header.php"; ?>
+<? include "db.php"; ?>
+<?
+	$db = new DB($mysql_host, $mysql_user, $mysql_password, $mysql_db);
+?>
+<?
+
+$mount = "";
+
+if (isset($_REQUEST["mount"])) {
+	$mount=$_REQUEST["mount"];
+}
+$username = "";
+
+if (isset($_REQUEST["username"])) {
+	$username=$_REQUEST["username"];
+}
+
+$showall = "";
+if (isset($_REQUEST["showall"])) {
+	$showall=$_REQUEST["showall"];
+}
+$showusers = "";
+if (isset($_REQUEST["showusers"])) {
+	$showusers=$_REQUEST["showusers"];
+}
+
+?>
+<h2>Reports</h2>
+<div class="roundcont">
+<div class="roundtop">
+<img alt="" src="images/corner_topleft.jpg" class="corner" style="display: none" />
+</div>
+<div class="newscontent">
+<?
+if (($mount == "") && ($username == "")) {
+?>
+Pick a report :<br>
+<form method=GET action="reports.php">
+<h3>By Mountpoint</h3>
+<p>
+Select Mountpoint : 
+<select name="mount">
+<?
+$query = "select mountpoint_name from ".$table_prefix."mountpoints";
+$result = mysql_query($query, $db->link);
+while ($row = mysql_fetch_assoc($result)) {
+    $availablemount = $row['mountpoint_name'];
+    echo "<option value='$availablemount'>$availablemount";
+}
+mysql_free_result($result);
+?>
+</select>
+<input type="Submit">
+</p>
+</form>
+<form method=GET action="reports.php">
+<h3>By Mountpoint</h3>
+<p>
+Select User : <input type="text" name="username" size=30>
+<input type="Submit">
+</p>
+</form>
+<?
+}
+else {
+	if ($username != "") {
+		// Username Report
+		echo "<h3>User Report for $username</h3>";
+		echo "<b>Registered Mountpoints</b><br><br>";
+		echo "<table border=1 cellpadding=10 cellspacing=0>";
+		echo "<tr><td bgcolor=black>Mountpoint</td><td bgcolor=black>Time Restrictions</td></tr>";
+		$query = "select mountpoint, timeleft from ".$table_prefix."users where username = '".mysql_real_escape_string($username)."'";
+		$result = mysql_query($query, $db->link);
+		while ($row = mysql_fetch_assoc($result)) {
+			$mountpoint = $row['mountpoint'];
+			$timeleft = 0;
+			$timeleft = $row['timeleft'];
+			if ($timeleft != "-1") {
+				$timerestriction = "$timeleft seconds left";
+			}
+			else {
+				$timerestriction = "No time restrictions";
+			}
+			echo "<tr><td>$mountpoint</td><td>$timerestriction</td></tr>";
+		}
+		echo "</table>";
+		mysql_free_result($result);
+
+		echo "<br><br>";
+		echo "<b>Audit Entries (last 20) Click <a href='reports.php?username=".urlencode($username)."&showall=1'>here</a> for a full report</b><br><br>";
+		$limit = "";
+
+		if ($showall == "") {
+			$limit = "limit 20";
+		}
+		$query = "select count(*) numentries from ".$table_prefix."audit where username = '".mysql_real_escape_string($username)."'";
+		$result = mysql_query($query, $db->link);
+		$row = mysql_fetch_assoc($result);
+		$entrycount = $row['numentries'];
+		mysql_free_result($result);
+
+		echo "<font color=yellow>$entrycount</font> total audit entries<br><br>";
+		echo "<table width=100% border=1 cellpadding=10 cellspacing=0>";
+		echo "<tr><td bgcolor=black>Date</td><td bgcolor=black>Server/Mount</td><td bgcolor=black>Action</td></tr>";
+		$query = "select datestamp, server, mountpoint, action from ".$table_prefix."audit where username = '".mysql_real_escape_string($username)."' order by datestamp desc $limit";
+		$result = mysql_query($query, $db->link);
+		while ($row = mysql_fetch_assoc($result)) {
+			$datestamp = $row['datestamp'];
+			$server = $row['server'];
+			$mountpoint = $row['mountpoint'];
+			$action = $row['action'];
+			echo "<tr><td>$datestamp</td><td>$server$mountpoint</td><td>$action</td></tr>";
+		}
+		echo "</table>";
+		mysql_free_result($result);
+
+		echo "</p>";
+	}
+	if ($mount != "") {
+		// Mountpoint report
+		echo "<h3>Mountpoint Report for $mount</h3>";
+		$query = "select count(*) entrycount from ".$table_prefix."users where mountpoint = '".mysql_real_escape_string($mount)."' or mountpoint = 'ALL'";
+		$result = mysql_query($query, $db->link);
+		$row = mysql_fetch_assoc($result);
+		$entrycount = $row['entrycount'];
+		mysql_free_result($result);
+		echo "<b>Registered Listeners : <a href='listusers.php?mount=".urlencode($mount)."'><font color=yellow>$entrycount</font></a></b><br><br>";
+
+		echo "<br>";
+		if ($showusers == "") {
+			$query = "select count(*) entrycount from ".$table_prefix."audit where username = '' and mountpoint = '".mysql_real_escape_string($mount)."'";
+			$result = mysql_query($query, $db->link);
+			$row = mysql_fetch_assoc($result);
+			$entrycount = $row['entrycount'];
+			mysql_free_result($result);
+
+			echo "Click <a href='reports.php?showusers=1&mount=".urlencode($mount)."'>here</a> for a listener audit report<br><br>";
+			echo "<b>Mount Connect/Disconnect Audit Entries (last 20) Click <a href='reports.php?mount=".urlencode($mount)."&showall=1'>here</a> for a full report</b><br>";
+			$limit = "";
+
+			if ($showall == "") {
+				$limit = "limit 20";
+			}
+
+			echo "<font color=yellow>$entrycount</font> total audit entries<br><br>";
+			echo "<table width=100% border=1 cellpadding=10 cellspacing=0>";
+			echo "<tr><td bgcolor=black>Date</td><td bgcolor=black>Server/Mount</td><td bgcolor=black>Action</td></tr>";
+			$query = "select datestamp, server, mountpoint, action from ".$table_prefix."audit where username = '' and mountpoint = '".mysql_real_escape_string($mount)."' order by datestamp desc $limit";
+			$result = mysql_query($query, $db->link);
+			while ($row = mysql_fetch_assoc($result)) {
+				$datestamp = $row['datestamp'];
+				$server = $row['server'];
+				$mountpoint = $row['mountpoint'];
+				$action = $row['action'];
+				echo "<tr><td>$datestamp</td><td>$server$mountpoint</td><td>$action</td></tr>";
+			}
+			echo "</table>";
+			mysql_free_result($result);
+		}
+		else {
+			$query = "select count(*) entrycount from ".$table_prefix."audit where username != '' and mountpoint = '".mysql_real_escape_string($mount)."'";
+			$result = mysql_query($query, $db->link);
+			$row = mysql_fetch_assoc($result);
+			$entrycount = $row['entrycount'];
+
+			mysql_free_result($result);
+			echo "Click <a href='reports.php?mount=".urlencode($mount)."'>here</a> for a Mountpoint connect/disconnect audit report<br><br>";
+			echo "<b>Listener Audit Entries (last 20) Click <a href='reports.php?showusers=1&mount=".urlencode($mount)."&showall=1'>here</a> for a full report</b><br>";
+			$limit = "";
+
+			if ($showall == "") {
+				$limit = "limit 20";
+			}
+
+			echo "<font color=yellow>$entrycount</font> total audit entries<br><br>";
+			echo "<table width=100% border=1 cellpadding=10 cellspacing=0>";
+			echo "<tr><td bgcolor=black>Date</td><td bgcolor=black>Server/Mount</td><td bgcolor=black>User</td><td bgcolor=black>Action</td></tr>";
+			$query = "select datestamp, username, server, mountpoint, action from ".$table_prefix."audit where username != '' and mountpoint = '".mysql_real_escape_string($mount)."' order by datestamp desc $limit";
+			$result = mysql_query($query, $db->link);
+			while ($row = mysql_fetch_assoc($result)) {
+				$datestamp = $row['datestamp'];
+				$server = $row['server'];
+				$mountpoint = $row['mountpoint'];
+				$action = $row['action'];
+				$username = $row['username'];
+				echo "<tr><td>$datestamp</td><td>$server$mountpoint</td><td>$username</td><td>$action</td></tr>";
+			}
+			echo "</table>";
+			mysql_free_result($result);
+		}
+
+		echo "</p>";
+	}
+}
+?>
+	<br>
+</p>
+</div>
+<div class="roundbottom">
+<img alt="" src="images/corner_bottomleft.jpg" class="corner" style="display: none" />
+</div>	
+</div>
+<? include "footer.php"; ?>

Added: icecast/trunk/icecast_auth/style.css
===================================================================
--- icecast/trunk/icecast_auth/style.css	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/style.css	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,198 @@
+/******************************************************************************
+
+	This file styles the bar that goes across the top of all Xiph.Org
+	pages.
+	
+	The style that comes from this was first (to my knowledge) at
+	http://alistapart.com/stories/practicalcss/ in the
+	"Splitting the Difference" section.
+
+******************************************************************************/
+
+/* This effect doesn't work at all if all content is pinched in a bit. */
+html, body {
+	margin: 0;
+	padding: 0;
+}
+
+.xiphnav {
+    font-family: Verdana, sans-serif;
+	font-weight: normal;
+    padding:    .25em;
+    margin-bottom:  .5em;
+    border-bottom:  1px solid #000;
+    color: #000;
+    background: #aaa;
+}
+h2 {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: bold;
+    font-size: 150%;
+    color: #FFFFFF;
+}
+h3 {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-size: 110%;
+    color: #FFFFFF;
+}
+.nav {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: normal;
+    color: #FFFFFF;
+}
+.nav:hover {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: normal;
+    color: #F8EF64;
+}
+.xiphnav_a {
+    text-decoration: none;
+    font-weight: normal;
+    color: #000;
+}
+.news {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: normal;
+    color: #FFFFFF;
+}
+.newsheader {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: normal;
+    font-size: 110%;
+    color: #F8EF64;
+    background: #444444;
+}
+.streamtd {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: normal;
+    font-size: 85%;
+    color: #FFFFFF;
+    padding:15px;
+}
+.streamtd_alt {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: normal;
+    font-size: 85%;
+    color: #FFFFFF;
+}
+#listen {
+	margin: 2px 2px 2px 2px;
+	border-style: solid;
+	border-width: 2px;
+	border-color: #7B96C6;
+	background-color: #dddddd;
+}
+.listen_a {
+    text-decoration: none;
+    font-weight: normal;
+    background-color: #dddddd;
+    color: #000;
+}
+.listen_a:hover {
+    text-decoration: none;
+    font-weight: normal;
+    color: #0000ff;
+}
+
+.streamtd_alt_2 {
+    font-family: Verdana, sans-serif;
+    text-decoration: underline;
+    font-weight: normal;
+    font-size: 85%;
+    color: #FFFFFF;
+}
+
+td {
+    font-family: Verdana, sans-serif;
+    text-decoration: none;
+    font-weight: normal;
+    color: #FFFFFF;
+}
+.roundcont {
+	width: 90%;
+	background-color: #656565;
+	color: #fff;
+}
+
+.newscontent {
+	margin: 0 20px;
+}
+.newscontent h3 {
+	margin: 10px 0px;
+	font-family: Verdana, sans-serif;
+	text-decoration: none;
+	font-weight: bold;
+	font-size: 110%;
+	color: #F8EF64;
+        border-bottom:  3px dashed #000000;
+}
+.example {
+	margin: 10px 0px;
+	font-family: Courier,Verdana, sans-serif;
+	text-decoration: none;
+	font-weight: bold;
+	font-size: 90%;
+}
+.newscontent h4 {
+	margin: 10px 0px;
+	font-family: Verdana, sans-serif;
+	text-decoration: none;
+	font-weight: bold;
+	font-size: 110%;
+	color: #F8EF64;
+}
+.newscontent p {
+	margin: 0 0;
+	font-family: Verdana, sans-serif;
+	text-decoration: none;
+	font-weight: none;
+	font-size: 90%;
+}
+.newscontent a {
+    font-family: Verdana, sans-serif;
+    text-decoration: underline;
+    font-weight: bold;
+    color: #FFFFFF;
+}
+.newscontent a:hover {
+    font-family: Verdana, sans-serif;
+    text-decoration: underline;
+    font-weight: bold;
+    color: #F8EF64;
+}
+.poster {
+	margin: 10px 0px;
+	display: block;
+	text-decoration: none;
+	font-size: 80%;
+	color: #F8EF64;
+    border-top:  3px dashed #000000;
+}
+.roundcont p {
+	margin: 10px 50px;
+}
+
+.roundtop { 
+	background: url(images/corner_topright.jpg) no-repeat top right; 
+}
+
+.roundbottom {
+	background: url(images/corner_bottomright.jpg) no-repeat top right; 
+}
+
+img.corner {
+	width: 15px;
+	height: 15px;
+	border: none;
+	display: block !important;
+}
+
+

Added: icecast/trunk/icecast_auth/testauth.php
===================================================================
--- icecast/trunk/icecast_auth/testauth.php	2005-09-21 12:14:15 UTC (rev 10035)
+++ icecast/trunk/icecast_auth/testauth.php	2005-09-22 13:39:55 UTC (rev 10036)
@@ -0,0 +1,12 @@
+<form method=POST action="action.php">
+<table border=0>
+<tr><td>Username</td><td><input type=text name="user" size=30></td></tr>
+<tr><td>Password</td><td><input type=text name="pass" value="monkey" size=30></td></tr>
+<tr><td>Mountpoint</td><td><input type=text name="mount" value="/mystream.ogg" size=30></td></tr>
+<tr><td>Server</td><td><input type=text name="server" value="localhost" size=30></td></tr>
+<tr><td>Port</td><td><input type=text name="port" value="8000" size=30></td></tr>
+<tr><td>Action</td><td><input type=text name="action" value="auth" size=30></td></tr>
+
+</table>
+<input type="Submit">
+</form>



More information about the commits mailing list