Lassie Posted June 7, 2007 Share Posted June 7, 2007 I am trying to debug my download script and keep getting the php code displayed in the browser but I cant work out why. The code is 500 lines so I have only posted the code from thepoint where it displays in th browser. Any pointers welcome. # Pagination Start. #------------------ if ($records_per_page < 1) { $records_per_page = $totalfiles + 1; } if ($totalfiles > $records_per_page) { $totalpages = ceil($totalfiles/$records_per_page); $flag = 0; if ($currentpage > $totalpages) { $currentpage = 1; } }ELSE { $flag = 1; } include_once('./includes/form_header.php'); # Start main loop. #----------------- if ($match > 0) { while (list ($key, $val) = each ($filename)) { if ($key >= ($records_per_page-$records_per_page)+(($currentpage-1)*$records_per_page) && $key <= ($records_per_page-1)+(($currentpage-1)*$records_per_page)) { $fileattr = explode("|", $val); # Fix and format Byte Length #--------------------------- if ($fileattr[4] < pow(2,10)){ $size = "$fileattr[4] B"; } if ($fileattr[4] >= pow(2,10) && $fileattr[4] < pow(2,20)) { $size = round($fileattr[4] / pow(2,10), 2)." KB"; } if ($fileattr[4] >= pow(2,20) && $fileattr[4] < pow(2,30)) { $size = round($fileattr[4] / pow(2,20), 2)." MB"; } if ($fileattr[3] > pow(2,30)) { $size = round($fileattr[4] / pow(2,30), 2)." GB"; } # Alternate colors between white and grey (or black and grey) on table entries. #------------------------------------------------------------------------------ if ($color == $color1){ $color = $color2; }ELSE{ $color = $color1; } # Get correct icon file depending on file extention. #--------------------------------------------------- $ext = substr ($fileattr[3], 1, 3); $ext = (strtolower($ext)); $iconfile = "./file_info/thumbs/th_$fileattr[2]"; $nw = 100; $nh = 64; $xtrainfo = "Jpeg image "; if (($ext == "jpg") && (!file_exists($iconfile)) && ($gdlib == 1)) { $ht = thumbnail("$path$fileattr[2]",$thumbsize,"./file_info/thumbs/","th_$fileattr[2]"); } # Get the correct icon file if image exists with same name as filename. #---------------------------------------------------------------------- if (($ext <> "jpg") or ($gdlib == 0)){ $xtrainfo = "$ext file"; $iconfile = "file_info/icons/$icons/x.gif"; $iconfile1 = "file_info/icons/$icons/$ext.gif"; $iconfile2 = "file_info/thumbs/th_$fileattr[1].jpg"; $nw = 64; $nh = 64; if (file_exists($iconfile1)) { $iconfile = $iconfile1; } if (file_exists($iconfile2)) { $iconfile = $iconfile2; } } include_once('./includes/display_output.php'); } } #------------------------------------------------------------------------------------- # End main loop. include_once('./includes/Footer.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/54567-debug-problem/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.