$title\n"; echo "Last modified on $date UTC by $user
\n\n"; include "$post"; echo "\n
Back to Blog"; } else { $offset=0; if ($_GET['index'] != "" && !is_int($_GET['index'])) { $offset = 10*$_GET['index']; } //slurp up the files $files = glob("blog/*.post"); $guid = count($files); //sort by filename //initialize an array to house sort results $files2 = array(); $files2 = array_pad($files2,$guid,0); for ($i=0; $i<$guid; $i++) { $j = explode('-',basename($files[$i])); $j = $j[0]; $j = (int)$j; $j--; $files2[$j] = $files[$i]; } $slen = count($files2)-1; $ctr=0; $older=0; for ($i=$slen-$offset; $i>-1; $i--) { $shitpost=$files2[$i]; //using a counter here to know when to stop, since I don't know how many posts there will be if ($ctr > 9) { $older=1; break; } $ctr++; $statz = stat($shitpost); $uid = $statz['uid']; $udata = posix_getpwuid($uid); $user = $udata['name']; $date = date("F d Y H:i:s", filemtime($shitpost)); $title = substr(strstr(basename($shitpost),'-'),1,-5); echo "

$title

\n"; echo "Last modified on $date UTC by $user
\n"; include $shitpost; echo "
"; }; echo "
"; if ($older) { $offset=$_GET['index']+1; echo "Older Posts"; } echo ""; if ($_GET['index'] != "") { $offset=$_GET['index']-1; if ($offset == 0) { echo "Newer Posts"; } else { echo "Newer Posts"; } } echo "
\n"; } ?>