Annotation of mp3/bin/deleteplaylist.pl, Revision 1.3
1.1 andrew 1: #!/usr/bin/perl -w
1.3 ! andrew 2: # $RedRiver: deleteplaylist.pl,v 1.2 2006/08/12 00:14:53 andrew Exp $
1.1 andrew 3: ########################################################################
4: # DeletePlaylist.plx ***
5: #
6: # 01-10-??
7: # Written by andrew fresh <andrew@mad-techies.org>
8: ########################################################################
9: use strict;
10: use diagnostics;
11:
12: use CGI qw/:standard/; # load standard CGI routines
13: use CGI::Carp qw(fatalsToBrowser);
14:
15: my $query = new CGI;
16:
17: my $vars = $query->Vars;
18:
19:
20: ########################################################################
21: # *** MAIN ***
22: ########################################################################
1.3 ! andrew 23:
! 24: my $prefix = $ENV{'QUERY_STRING'};
! 25: if ($prefix) {
! 26: $prefix =~ s/%(..)/pack("c",hex($1))/ge;
! 27: } else {
! 28: $prefix ='';
! 29: }
! 30:
! 31: my $list = '/var/www/mp3/playlist/' . $prefix . 'playlist.lst';
! 32:
! 33:
1.1 andrew 34: print "Content-Type: text/html\n\n";
35: print "<html>\n<head>\n\t<meta HTTP-EQUIV='Pragma' CONTENT='no-cache'> <title>Deleting Playlist</title>\n";
36: print "<body>\n\n";
37:
38: #MakeTemp("$configs{DIRftp}/$station/$configs{FILESnew}");
39: #use File::Copy;
40: #copy("$configs{DIRcfgs}/$station.$configs{FILEplaylist}", "$configs{DIRftp}/$station/$station.$configs{FILEplaylist}");
41:
42: #Print_Nav();
43:
44: if ($$vars{confirm} && ($$vars{confirm} eq "true")) {
45: delplaylist();
46: } else {
47: confirm();
48: }
49:
50: print "<a href=\"showfiles.pl\">Back to Beginning</a>";
51: print "</body>\n</head>\n</html>\n";
52:
53: sub confirm {
54: print "<h2>Confirm Playlist Delete</h2>\n";
55: print "<P>Do you really want to do this? Would you want someone deleting <I>YOUR</I> playlist?</P>\n";
56: print "<p><a href=\"deleteplaylist.pl\?confirm=true\">Click here to confirm Playlist Deletion</a></p>\n";
57: }
58:
59:
60: sub delplaylist {
61: print "<h2>Deleting Playlist</h2>\n";
62: if (-e $list) {
63: if (open FILE, ">$list") {
64: print FILE "";
65: print "<p>Playlist deleted</p>\n";
66: close FILE;
67: } else {
68: 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";
69: }
70: } else {
71: 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";
72: }
73: }
74:
75:
76: sub Print_Nav
77: {
78: open FILE, 'nav.inc' or die "\n\ncouldn't open FILE nav.inc: $!";
79: while (<FILE>) {
80: print;
81: }
82: close FILE;
83: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>