frigate Posted February 19, 2010 Share Posted February 19, 2010 Hey guys, A few years ago my friend wrote a small script for a page on my site where my friends and I can upload pictures or whatever to share with each other. My server switched from PHP4 to 5 and it broke the function that allows you to sort the uploaded files by year: if you click on a previous year, it just shows the current one. It's kind of lame since I've had my site for over 4 years and I can only see a tiny fraction of the files without FTPing. Anyway, this is some of the code for the page that allows you to browse files, browse.php (if needed I can post the rest of the code): <? //List the possible years function ArrayToURL($Arr) //Takes in an array and prepares its variables to be outputed as parameters in a URL { $RetArray=Array(); foreach($Arr as $Key =>$Val) $RetArray[]=urlencode($Key)."=".urlencode($Val); return implode("&",$RetArray); } $StartYear=2006; //First year to list $Dates=array_merge(Array("All"), range($StartYear, date("Y"))); //Possible Years $Year=(!isset($Year) || !in_array($Year, $Dates) ? date("Y") : $Year); //Set the current year to this year if not set or invalid foreach($Dates as $Date) //Print out the possibilities print ($Year!=$Date ? "<a href=browse.php?".ArrayToURL(array_merge($_GET, Array('Year'=>$Date))).">" : "").$Date.($Year!=$Date ? "</a>" : "")." "; ?> | Sort: <? //List possible sorts $Sorts=Array("Date Up", "Date Down", "Name Up", "Name Down"); //Possible Sorts $Sort=(!isset($Sort) || !in_array($Sort, $Sorts) ? "Date Up" : $Sort); //Set the current sort to "Date Up" if not set or invalid foreach($Sorts as $CurSort) //Print out the possibilities print ($Sort!=$CurSort ? "<a href=browse.php?".ArrayToURL(array_merge($_GET, Array('Sort'=>$CurSort))).">" : "").$CurSort.($Sort!=$CurSort ? "</a>" : "")." "; ?> If it's not too much trouble I'd be really really grateful if someone could help I tried searching the site but I couldn't find anything, maybe I'm just not familiar enough with PHP to search for the right terms though. Link to comment https://forums.phpfreaks.com/topic/192582-switched-from-php4-to-5-broke-part-of-my-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.