#!/usr/bin/perl -w # $RedRiver: deleteplaylist.pl,v 1.2 2006/08/12 00:14:53 andrew Exp $ ######################################################################## # DeletePlaylist.plx *** # # 01-10-?? # Written by andrew fresh ######################################################################## use strict; use diagnostics; use CGI qw/:standard/; # load standard CGI routines use CGI::Carp qw(fatalsToBrowser); my $query = new CGI; my $vars = $query->Vars; ######################################################################## # *** MAIN *** ######################################################################## my $prefix = $ENV{'QUERY_STRING'}; if ($prefix) { $prefix =~ s/%(..)/pack("c",hex($1))/ge; } else { $prefix =''; } my $list = '/var/www/mp3/playlist/' . $prefix . 'playlist.lst'; print "Content-Type: text/html\n\n"; print "\n\n\t Deleting Playlist\n"; print "\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 "Back to Beginning"; print "\n\n\n"; sub confirm { print "

Confirm Playlist Delete

\n"; print "

Do you really want to do this? Would you want someone deleting YOUR playlist?

\n"; print "

Click here to confirm Playlist Deletion

\n"; } sub delplaylist { print "

Deleting Playlist

\n"; if (-e $list) { if (open FILE, ">$list") { print FILE ""; print "

Playlist deleted

\n"; close FILE; } else { print "

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

\n"; } } else { print "

Could not delete playlist. It doesn't seem that there was a playlist. You know it plays all the time now right?

\n"; } } sub Print_Nav { open FILE, 'nav.inc' or die "\n\ncouldn't open FILE nav.inc: $!"; while () { print; } close FILE; }