whiteboikyle Posted June 18, 2008 Share Posted June 18, 2008 Well i took the hard way of doing this from the get go.. So.. this is probably going to be 1 of the hardest parts of the scripts. Okay well there is a Login/Register. When they register it makes them their own folder of their login name. Its an upload site where they can upload all their files to their folder.. Well now i am making a Top Upload page.. Where it shows who has the most uploads.. Well i got a function to work to tell you how many files their are in their folder.. The hardest part is what i am trying to do.. Get all the usernames.. Then use this function to figure out everyones number count on uploads.. Then orginize them from greatest to least.. Limiting 20 per page.. function.php function count_dir($look){ $pictures = array(); if($dir = @opendir("./$look")){ while (($file = readdir($dir)) !== false){ if($file == "home.php"){ continue; } if($file != "." && $file != ".."){ $pictures[] = $file; } } closedir($dir); } $countfiles = count($pictures); return $countfiles; } Quote Link to comment Share on other sites More sharing options...
Stephen Posted June 18, 2008 Share Posted June 18, 2008 Can you give me the table with the users in it's name, and the columns of it? Quote Link to comment Share on other sites More sharing options...
Jabop Posted June 18, 2008 Share Posted June 18, 2008 <?php $Folder="content/images"; $Images=glob(SERVER_ROOT.$Folder.'/*.{gif,GIF,jpg,JPG,jpeg,JPEG,png,PNG,tiff,TIFF}',GLOB_BRACE); $x=0; foreach($Images as $i) { $Name=explode("/",$i); $Name=array_pop($Name); $Name=explode(".",$Name); $Ext=array_pop($Name); $Ext=strtolower($Ext); $FileName=implode(".",$Name); $x++; $Totalsize=filesize($image)+$Totalsize; } echo $x." images for ".$user." at a total of ".number_format($Totalsize/1024,2); ?> This is a script I made to count images in a directory, based off of their filetype, (and do other things, but that's beyond the point). Modify it to your needs, it seems easier than the method you're currently pursuing. Quote Link to comment Share on other sites More sharing options...
whiteboikyle Posted June 18, 2008 Author Share Posted June 18, 2008 Jabob thanks for your function but i am really trying to do this 100% custom code.. Like i need help and tweaks along the ways.. But that is very nice! I really do appreciate it. More of a learning process for me Stephen the table with the users is members.. the columns inside it is id username password email Quote Link to comment 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.