Jump to content

Top Members page


whiteboikyle

Recommended Posts

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;
} 

Link to comment
https://forums.phpfreaks.com/topic/110699-top-members-page/
Share on other sites

<?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.

Link to comment
https://forums.phpfreaks.com/topic/110699-top-members-page/#findComment-567941
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/110699-top-members-page/#findComment-567954
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.