Hi,
Thanks to everyone for the comments and ideas. I have decided that the use of m3u files is the way forward, just as soon as my host enables support of the MIME type.
I do have one further question on this topic that hope you may be able to help with. The downloads section of the website is only available to memebers and I want to log which members download which files. Each download is set under a category, so if I know which files have been downloaded I can recommend future files from the same category when the user logs into the member profile pages.
At present I have an onclick method on the link that calls a java script function:
-
function dataUpdate(pnType, pnItem)
-
{
-
GetXmlHttpObject() ; // a udf that I know works as it is used elsewhere
-
gcUrl = "../lib/dataupdateAJAX.php?type=" + pnType + "&item=" + pnItem ;
-
goXMLHTTP.onreadystatechange = function()
-
{
-
if (goXMLHTTP.readyState==4 || goXMLHTTP.readyState=="complete")
-
{
-
var lIsDone = true;
-
}
-
} ;
-
goXMLHTTP.open("GET",gcUrl,true) ;
-
goXMLHTTP.send(null) ;
-
}
-
I have had an alert in the above code so that I know it is being called, however the PHP page that is referenced in the above code does not seem to be getting called.
Here is the php:
[php]
<?php
session_start();
if(!empty($_GET['type']) && !empty($_GET['item']))
{
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/dataobjects.php');
$loDB = new dataObject("database", "user", "password", "host");
$lnUpdateType = $_GET['type'] ;
$lnItem = $_GET['item'] ;
switch($lnUpdateType)
{
case 1: // update the association between leaders and downloads
$lnLeaderID = $_SESSION['userID'] ;
// first check that the leader does not already have the download associated with them, if they do there is no reason to load it again.
$lcCheckSQL = "SELECT a.ID, a.frequency + 1 as newFrequency from leaderdownloadassociation a WHERE a.leaderID = $lnLeaderID AND a.downloadID = $lnItem" ;
$laAssociation = $loDB->queryGetData($lcCheckSQL) ;
if($laAssociation)
{
// update the frequency
$lnFrequency = $laAssociation[0]['newFrequency'] ;
$lcUpdate = "UPDATE leaderdownloadassociation set frequency = $lnFrequency, editdate = now() WHERE a.leaderID = $lnLeaderID AND a.downloadID = $lnItem" ;
$loDB->iQuery($lcUpdate) ;
}
else // first download
{
$lcTableName = "leaderdownloadassociation" ;
$lcFieldList = "leaderID, downloadID, frequency, createdate, editdate" ;
$lcValueList = "$lnLeaderID, $lnDownloadID, 1, now(), now()";
$loDB->queryInsert($lcTableName, $lcFieldList, $lcValueList, false) ;
}
break ;
}
}
?>
[/php]
The idea here is that if there is already a link between a member and a download then the number of times they have downloaded the file is increased and the edit data of the record is updated.
For some reason the code in the PHP does not seem to be executing. I have thrown an echo into the code and it does not display.
I was wondering if anyone could shed any light on this, or suggest an alternative to solution to the problem.
Cheers
nathj