Skip to content

Categories:

Vlindertjevleugelvernielveel

After making the tank game (rupsbandjenooitgenoeg) we thought it might have gotten a bit complicated. The points Jos has to get are pretty basic. (To understand more about this, read the Rupsbandjenooitgenoeg post).

So we created a simple, top to bottom scrolling shooter!

And we did this within 8 hours.

Check out the result at: www.moors-code.com/vlinder/

Posted in Flash.

Tagged with .


Rupsbandjenooitgenoeg

Jos, a friend of mine, who I know from school asked if I could help him make a Flash game. He has to get some final points before he’s allowed to graduate. So I said yes!

Rupsbandjenooitgenoeg (based upon caterpillar very hungry in dutch with an added joke) is the result of this project!

Check it out at: www.moors-code.com/rups/

Posted in Flash.

Tagged with .


Directory listing

A simple directory lister, with custom download function for all files. This way you can download all files, no matter what the server would do with them on default.

  1. <?php
  2. $download $_GET['file'];
  3.  
  4. if(file_exists($download)) {
  5.     header("content-disposition:attachment;filename=\"" $download "\"");
  6. /*    header("content-type:" . ); */
  7.     header("Content-Length: " filesize($download));
  8.     echo file_get_contents($download);
  9.     die();
  10. }
  11.  
  12. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  13. <html xmlns="http://www.w3.org/1999/xhtml">
  14. <head>
  15.     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  16.   <style type="text/css">
  17.     td {
  18.         font-family: Georgia, "Times New Roman", Times, serif;
  19.         font-size: 12px;
  20.         border-top: 1px dotted black;
  21.     }
  22.     
  23.     table { border: 1px solid black; }
  24.     thead { background-color: #efefef; }
  25.     thead td { font-weight: bold; border-top: none; }
  26.     
  27.     a, a:visited, a:active {
  28.         color: #006;
  29.         text-decoration: none;
  30.     }
  31.     
  32.     a:hover {
  33.         color: #030;
  34.         text-decoration: underline;
  35.     }
  36.     </style>
  37.     <title>Directory listing</title>
  38. </head>
  39. <body>
  40.  
  41. <H1>Directory listing: <?= $_SERVER['REQUEST_URI'?></H1>
  42. <table cellspacing="0" cellpadding="4" width="500">
  43. <thead>
  44. <tr>
  45.   <td width="60" align="right">Size</td>
  46.     <td width="16">&nbsp;</td>
  47.   <td>File</td>
  48.   <td width="150" align="right">Last modified</td>
  49.     <td width="16">&nbsp;</td>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. <?php
  54. $dir opendir("./");
  55. while($file readdir($dir)) {
  56.     clearstatcache();
  57.     
  58.     if(is_file($file) && $file != basename(__FILE__)) {
  59.         $ext "";
  60.         
  61.         $split split("\."$file);
  62.         if(is_array($split)) {
  63.             $ext "<img src='/images/filetypes/".end($split).".gif' />";
  64.         }
  65.         
  66.         $stat stat($file);
  67.         $size getsize($stat['size']);
  68.         $change date('F jS, Y - m:i'$stat['mtime']);
  69.         
  70.         echo "<tr></td><td align='right'>$size</td><td>$ext</td><td><a href='$file' title='open'>$file</a></td><td align='right'>$change</td><td><a href='?file=$file'><img src='/images/download.gif' title='download' border='0' /></a></tr>\n";
  71.     }
  72. }
  73. closedir($dir);
  74. ?>
  75. </tbody>
  76. </table>
  77.  
  78. </body>
  79. </html><?php
  80. function getsize($size) {
  81.     $si = array('b''kb''mb''gb''tb''pb''eb''zb''yb');
  82.     $remainder $i 0;
  83.     while ($size >= 1024 && $i 8) {
  84.         $remainder = (($size 0x3ff) + $remainder) / 1024;
  85.         $size $size >> 10;
  86.         $i++;
  87.     }
  88.     return round($size $remainder2) . ' ' $si[$i];
  89. }
  90. ?>

An example has been added to the examples directory.

Posted in PHP.