Ok. Did all that, now get:
Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in /home/usr/public_html/downloads/audio2.php on line 31
Line 31 is:
$connstring = $db_connstring;
Here is the updated code I am using:
<?php
//prevents caching
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter();
session_start();
//require the config file
require ("/home/usr/public_html/downloads/config.php");
require ("/home/usr/public_html/downloads/functions.php");
//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());
//make query to database
$row = mysql_fetch_array($result);
$sql ="SELECT * FROM $table_name WHERE username= '$username'";
$result = @mysql_query($sql,$connection) or die(mysql_error());
// Some functions
function get_database_row($s_db_query, $s_db_connstring="") {
if ($s_db_connstring == "") {
global $db_connstring; global $row
$connstring = $db_connstring;
} else {
$connstring = $s_db_connstring;
}
$file_list = getDirFiles("/home/usr/public_html/downloads/audio/" . $row['username'] . "/");
$count = count($file_list);
?>
<table border=0 width=100% bgcolor=0 cellpadding=5 cellspacing=0>
<tr>
<td bgcolor=#eeeeee style="font-family: Tahoma; font-size: 11px;"><b>
File Name (<?=$row['username'];?>)
</b></td>
<td bgcolor=#eeeeee style="font-family: Tahoma; font-size: 11px;"><b>
Size
</b></td>
<td bgcolor=#eeeeee style="font-family: Tahoma; font-size: 11px;"><b>
Date
</b></td>
</tr>
<?
$size = 0;
for($i=0;$i<=$count;$i++) {
$file = $file_list[$i];
$path = "/home/usr/public_html/downloads/audio/" . $row['username'] . "/";
if ($file != "index.php" && $file != "") {
?>
<tr>
<td bgcolor=#ffffff style="font-family: Tahoma; font-size: 11px;">
<img src="/images/file.gif" align=middle> <a href="/audio/<?=$row['username']?>/<?=$file?>?key=<?=time()?>&validate=md5&log_user=<?=$userid?>"><?=$file?></a>
</td>
<td bgcolor=#ffffff style="font-family: Tahoma; font-size: 11px;">
<?=round(filesize($path . $file)/1024/1024, 2);?> MB
</td>
<td bgcolor=#ffffff style="font-family: Tahoma; font-size: 11px;">
<?=date("m/d/y H:i:s", filectime($path . $file));?>
</td>
</tr>
<?
}
}
function getDirFiles($dirPath)
{
if ($handle = opendir($dirPath))
{
while (false !== ($file = readdir($handle)))
if ($file != "." && $file != "..")
$filesArr[] = trim($file);
closedir($handle);
}
@sort($filesArr);
@reset($filesArr);
return $filesArr;
}
function fsize($file){
$size=0;
$range = Array ('B', 'K', 'M', 'G');
if(is_dir($file))
if ($dh = opendir($file)){
while (($filecnt = readdir($dh)) !== false) {
if($filecnt == "." || $filecnt == "..")continue;
if(is_dir($file."/".$filecnt))
$size += fsize($file."/".$filecnt);
else
$size += filesize($file."/".$filecnt);
echo "\n$file/$filecnt";
}
closedir($dh);
}else
return false;
else
$size = filesize($file);
for ($i = 0; $size >= 1024 && $i < count($range); $i++)
$size /= 1024;
return round($filesize,2).$range[$i];
}
print("</td></tr></table>");
Thanks in advance...