Skip to content

Instantly share code, notes, and snippets.

@Adjokip Adjokip/scandir_pagination.php Secret
Created Aug 10, 2018

Embed
What would you like to do?
<?php
$files = [
'.',
'..',
'35hp.cc',
'35hp_2',
'aim_ak-colt',
'aim_headshot',
'awp_map',
'awp_india'
];
unset($files[0], $files[1]);
$perPage = 2;
$currentPage = (isset($_GET['page']) && (int)$_GET['page'] > 0) ? (int)$_GET['page'] : 1;
$offset = ($currentPage - 1)*$perPage;
$fileCount = count($files);
$pageCount = ceil($fileCount/$perPage);
$files = array_slice($files, $offset, $perPage);
echo "Showing $offset-".($offset+$perPage)." of $fileCount files.\n\n";
foreach ($files as $file) {
echo basename($file)."\n";
}
$uri = '?m=gamemanager&p=install_map&home_id='.$_GET['home_id'].'&mod_id='.$_GET['mod_id'].'&ip='.$_GET['ip'].'&port='.$_GET['port'].'&page=';
echo paginationPages($fileCount, $currentPage, $perPage, $uri, 3, 'gamemanager');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.