Return to deleteplaylist.pl CVS log | Up to [local] / mp3 / bin |
File: [local] / mp3 / bin / deleteplaylist.pl (download)
Revision 1.2, Sat Aug 12 00:14:53 2006 UTC (17 years, 11 months ago) by andrew
add RCS Ids. I am not sure why this wasn't committed when those were actually done, but it is now. |
#!/usr/bin/perl -w # $RedRiver$ ######################################################################## # DeletePlaylist.plx *** # # 01-10-?? # Written by andrew fresh <andrew@mad-techies.org> ######################################################################## use strict; use diagnostics; use CGI qw/:standard/; # load standard CGI routines use CGI::Carp qw(fatalsToBrowser); my $list = '/var/www/mp3/playlist/playlist.lst'; my $query = new CGI; my $vars = $query->Vars; ######################################################################## # *** MAIN *** ######################################################################## print "Content-Type: text/html\n\n"; print "<html>\n<head>\n\t<meta HTTP-EQUIV='Pragma' CONTENT='no-cache'> <title>Deleting Playlist</title>\n"; print "<body>\n\n"; #MakeTemp("$configs{DIRftp}/$station/$configs{FILESnew}"); #use File::Copy; #copy("$configs{DIRcfgs}/$station.$configs{FILEplaylist}", "$configs{DIRftp}/$station/$station.$configs{FILEplaylist}"); #Print_Nav(); if ($$vars{confirm} && ($$vars{confirm} eq "true")) { delplaylist(); } else { confirm(); } print "<a href=\"showfiles.pl\">Back to Beginning</a>"; print "</body>\n</head>\n</html>\n"; sub confirm { print "<h2>Confirm Playlist Delete</h2>\n"; print "<P>Do you really want to do this? Would you want someone deleting <I>YOUR</I> playlist?</P>\n"; print "<p><a href=\"deleteplaylist.pl\?confirm=true\">Click here to confirm Playlist Deletion</a></p>\n"; } sub delplaylist { print "<h2>Deleting Playlist</h2>\n"; if (-e $list) { if (open FILE, ">$list") { print FILE ""; print "<p>Playlist deleted</p>\n"; close FILE; } else { print "<p>Could not delete playlist. Maybe it's already deleted? If not, please wait 90 seconds and try again and if that doesn't work contact the system administrator</p>\n"; } } else { print "<p>Could not delete playlist. It doesn't seem that there was a playlist. You know it plays all the time now right?</p>\n"; } } sub Print_Nav { open FILE, 'nav.inc' or die "\n\ncouldn't open FILE nav.inc: $!"; while (<FILE>) { print; } close FILE; }