hi all, i have sucsesfully created a delete button that works

, the button is displayed to the left of each tick box. To create this I:
changed the File presentation template (under customize) to
- Code: Select all
<a href="%i"[ title="%a %y"]><span class="%c">[%R. ][%t - %l|%f]</span></a> <span class="finfo">[(%b kbit %s mins)] %S</span><div style="margin-top:-13; margin-left:-50; float:left;"><form action="#####/delete.php?do=delete" method="post" name="%f" target="_blank" id="%f"><input type="hidden" name="file" value="%f" id="file" /><input type="submit" name="b" id="b" value="X" style="border:none;background-color:#CCC;color:#F00;font-size:10px" /></form></div>
please note you will need to change #####
I then created a php file which deletes the files. this file will need to be uploaded into the music directory
- Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php delete file</title>
<link href="../kplaylist.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
<!--
function openwin(name, url)
{
popupWin = window.open(url, name, 'resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,width=675,height=320,left=150,top=270');
if (popupWin) popupWin.focus();
}
var jwflvwin = null;
function openJWFLV(theFile, url, height, width)
{
jwflvwin = open("", "jwflvwin", 'width='+width+',height='+height);
if (!jwflvwin || jwflvwin.closed || !jwflvwin.createPlayer)
{
jwflvwin = window.open(url, "jwflvwin", 'width='+width+',height='+height);
} else jwflvwin.focus();
jwflvwin.loadXMLDoc(theFile);
}
function newwinscroll(name, url, height, width)
{
popupWin = window.open(url, name, 'resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');
if (popupWin) popupWin.focus();
}
function newwin(name, url, height, width)
{
popupWin = window.open(url, name, 'resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');
if (popupWin) popupWin.focus();
}
function flashwin(name, url, height, width)
{
flashpop = window.open(url, name, 'resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');
if (flashpop) flashpop.focus();
}
function flashwinsharedplaylist(name, url, height, width)
{
d = document.getElementById('sel_shplaylist');
if (d) url = url + "&plid=" + d.value;
flashpop = window.open(url, name, 'resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');
if (flashpop) flashpop.focus();
}
function flashwinuserplaylist(name, url, height, width)
{
d = document.getElementById('sel_playlist');
if (d) url = url + "&plid=" + d.value;
flashpop = window.open(url, name, 'resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');
if (flashpop) flashpop.focus();
}
function savescrolly()
{
var scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' )
{
scrOfY = window.pageYOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop))
{
scrOfY = document.body.scrollTop;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop))
{
scrOfY = document.documentElement.scrollTop;
}
sy = document.getElementById('scrolly');
if (sy) sy.value = scrOfY;
}
function kptoggle()
{
for(var i=0;i<document.psongs.elements.length;i++)
{
if(document.psongs.elements[i].type == "checkbox")
{
if (document.psongs.elements[i].checked == false) document.psongs.elements[i].checked = true;
else
if (document.psongs.elements[i].checked == true) document.psongs.elements[i].checked = false;
}
}
}
function selectall()
{
for(var i=0;i<document.psongs.elements.length;i++)
if(document.psongs.elements[i].type == "checkbox") if (document.psongs.elements[i].checked == false) document.psongs.elements[i].checked = true;
}
function disselectall()
{
for(var i=0;i<document.psongs.elements.length;i++)
if(document.psongs.elements[i].type == "checkbox") if (document.psongs.elements[i].checked == true) document.psongs.elements[i].checked = false;
}
function anyselected()
{
for(var i=0;i<document.psongs.elements.length;i++) if(document.psongs.elements[i].type == "checkbox") if (document.psongs.elements[i].checked == true) return true;
return false;
}
function chhttp(where) {
document.location = where;
}
//-->
</script>
</head>
<body>
<?php
if (isset($_GET["do"])) {
$do = explode(":",$_GET["do"]);
}
$file=$_POST['file'];
// stage 1 _________________________________________________
if ($do[0] == "delete") {
echo "Attempting to delete <a href='$file'>$file</a>
< br/>
<form action='delete.php?do=deleting' method='post' name='confirm' id='confirm'>
Enter password:<input name='password' type='password' id='password'>
<input type='hidden' name='file' value='$file' id='file' />
<input type='submit' name='b' id='b' value='Confirm delete' style='border:none;background-color:#CCC;color:#F00;font-size:16px' />
</form><input class='fatbuttom' type='submit' name='button' value='Close' onclick='javascript: window.close(); '/>";
} // stage 2 _________________________________________________
elseif ($do[0] == "deleting") {
$pass=$_POST['password'];
if ($pass == "@@@@@") {
unlink($file) or die("$file was not deleted.");
if (!file_exists('$file')) { echo "<h2>$file has sucsesfully been deleted.</h2><input class='fatbuttom' type='submit' name='button' value='Close' onclick='javascript: window.close(); '/>"; }
} else {echo"You do not have permition to delete files<input class='fatbuttom' type='submit' name='button' value='Close' onclick='javascript: window.close(); '/>";}
}
else {echo "What you doing?< br/><input class='fatbuttom' type='submit' name='button' value='Close' onclick='javascript: window.close(); '/>";}
?>
</body>
</html>
remember to change ##### to your music directory and @@@@@ to your desired password
hope you like it