News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1184090344:v:use_geshi-1:v:type-php

Started by IchBin, Jul 10, 2007, 05:59 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

IchBin

 global $user_info, $sourcedir;

$dire='/home/tpnet/alpha';
$sdire='alpha/';

echo '<table align="center" width="500"><tr><td><h2>Alpha downloads</h2>';
$allowed=array('1','2','13','32','30','48','40','20','39','41','22','24');
$show=false;
for($b=0; $b<sizeof($allowed); $b++)
{
   if(in_array($allowed[$b], $user_info['groups']))
    $show=true;
}

if($show)
{
   if(isset($_GET['alpha']))
   {
      $name=$dire.'/'.$_GET['alpha'];
      $what=$_GET['alpha'];


      $fn = @fopen($name, "rb");
      if(!$fn)
         echo "File $what not found here";
      else
      {

         header('Content-Disposition: attachment; filename="' . $what . '"');
         header('Content-Type: application/octet-stream');
         fpassthru($fn);
         fclose($fn);
      }
   }


   // read the directory
   $filer = array();
   if ($handle = opendir($dire))
   {
      while (false !== ($file = readdir($handle)))
      {
         if($file!= '.' && $file!='..' && $file!='.htaccess' )
                        {
                             $dato=substr($file,6);
                              $rt=substr($dato,3,2).substr($dato,0,2);
            $filer[] = $rt.'-'.$file;
                     
                        }
      }
      closedir($handle);
      sort($filer);
      $filer=array_reverse($filer);
   }
        $st=true;
   $max=0;
         foreach($filer as $al)
        {
         $max++;
         if($max<20)
          {
                   $al=substr($al,5);
                   $dato=substr($al,6);
                   $dt=substr($dato,0,2).'.'.substr($dato,3,2).'  20'.substr($dato,6,2);

      if($st)
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }

                 echo '<div style="margin: 10px 0 10px 0; background: #f9f9f9; padding: 10px; border: solid 1px #d0d0d0;">
    Latest release: <a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]
           

Changes:
      <pre style="font-size: 10px; font-family: verdana; margin: 0;">'.$changelog.'</div>';
                   $st=false;
                 }
                else
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog2=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }
                   echo '<div><a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]</a>';
if($changelog2 != $changelog)
{
  echo '
Changes:
      <pre style="font-size: 10px; font-family: verdana; margin-top: 0;">'.$changelog2.'';
  $changelog=$changelog2;
}
echo '</div>';
               }
            }      
        }
}
else
  echo 'Sorry, no access.';
echo '</td></tr></table>';

SleePy

 global $user_info, $sourcedir;

$dire='/home/tpnet/alpha';
$sdire='alpha/';

echo '<table align="center" width="500"><tr><td><h2>Alpha downloads</h2>';
$allowed=array('1','2','13','32','30','48','40','20','39','41','22','24');
$show=false;
for($b=0; $b<sizeof($allowed); $b++)
{
   if(in_array($allowed[$b], $user_info['groups']))
    $show=true;
}

if($show)
{
   if(isset($_GET['alpha']))
   {
      $name=$dire.'/'.$_GET['alpha'];
      $what=$_GET['alpha'];


      $fn = @fopen($name, "rb");
      if(!$fn)
         echo "File $what not found here";
      else
      {

         header('Content-Disposition: attachment; filename="' . $what . '"');
         //header('Content-Type: application/octet-stream');            header('Content-Type: application/x-gzip');
         fpassthru($fn);
         fclose($fn);
      }
   }


   // read the directory
   $filer = array();
   if ($handle = opendir($dire))
   {
      while (false !== ($file = readdir($handle)))
      {
         if($file!= '.' && $file!='..' && $file!='.htaccess' )
                        {
                             $dato=substr($file,6);
                              $rt=substr($dato,3,2).substr($dato,0,2);
            $filer[] = $rt.'-'.$file;
                     
                        }
      }
      closedir($handle);
      sort($filer);
      $filer=array_reverse($filer);
   }
        $st=true;
   $max=0;
         foreach($filer as $al)
        {
         $max++;
         if($max<20)
          {
                   $al=substr($al,5);
                   $dato=substr($al,6);
                   $dt=substr($dato,0,2).'.'.substr($dato,3,2).'  20'.substr($dato,6,2);

      if($st)
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }

                 echo '<div style="margin: 10px 0 10px 0; background: #f9f9f9; padding: 10px; border: solid 1px #d0d0d0;">
    Latest release: <a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]
           

Changes:
      <pre style="font-size: 10px; font-family: verdana; margin: 0;">'.$changelog.'</div>';
                   $st=false;
                 }
                else
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog2=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }
                   echo '<div><a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]</a>';
if($changelog2 != $changelog)
{
  echo '
Changes:
      <pre style="font-size: 10px; font-family: verdana; margin-top: 0;">'.$changelog2.'';
  $changelog=$changelog2;
}
echo '</div>';
               }
            }      
        }
}
else
  echo 'Sorry, no access.';
echo '</td></tr></table>';
No siggy! :D

SleePy

 global $user_info, $sourcedir;

$dire='/home/tpnet/alpha';
$sdire='alpha/';

echo '<table align="center" width="500"><tr><td><h2>Alpha downloads</h2>';
$allowed=array('1','2','13','32','30','48','40','20','39','41','22','24');
$show=false;
for($b=0; $b<sizeof($allowed); $b++)
{
   if(in_array($allowed[$b], $user_info['groups']))
    $show=true;
}

if($show)
{
   if(isset($_GET['alpha']))
   {
      $name=$dire.'/'.$_GET['alpha'];
      $what=$_GET['alpha'];


      $fn = @fopen($name, "rb");
      if(!$fn)
         echo "File $what not found here";
      else
      {

         header('Content-Disposition: attachment; filename="' . $what . '"');
         //header('Content-Type: application/octet-stream');
         header('Content-Type: application/x-gzip');
         fpassthru($fn);
         fclose($fn);
      }
   }


   // read the directory
   $filer = array();
   if ($handle = opendir($dire))
   {
      while (false !== ($file = readdir($handle)))
      {
         if($file!= '.' && $file!='..' && $file!='.htaccess' )
                        {
                             $dato=substr($file,6);
                              $rt=substr($dato,3,2).substr($dato,0,2);
            $filer[] = $rt.'-'.$file;
                     
                        }
      }
      closedir($handle);
      sort($filer);
      $filer=array_reverse($filer);
   }
        $st=true;
   $max=0;
         foreach($filer as $al)
        {
         $max++;
         if($max<20)
          {
                   $al=substr($al,5);
                   $dato=substr($al,6);
                   $dt=substr($dato,0,2).'.'.substr($dato,3,2).'  20'.substr($dato,6,2);

      if($st)
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }

                 echo '<div style="margin: 10px 0 10px 0; background: #f9f9f9; padding: 10px; border: solid 1px #d0d0d0;">
    Latest release: <a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]
           

Changes:
      <pre style="font-size: 10px; font-family: verdana; margin: 0;">'.$changelog.'</div>';
                   $st=false;
                 }
                else
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog2=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }
                   echo '<div><a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]</a>';
if($changelog2 != $changelog)
{
  echo '
Changes:
      <pre style="font-size: 10px; font-family: verdana; margin-top: 0;">'.$changelog2.'';
  $changelog=$changelog2;
}
echo '</div>';
               }
            }      
        }
}
else
  echo 'Sorry, no access.';
echo '</td></tr></table>';
No siggy! :D

SleePy

 global $user_info, $sourcedir;

$dire='/home/tpnet/alpha';
$sdire='alpha/';

echo '<table align="center" width="500"><tr><td><h2>Alpha downloads</h2>';
$allowed=array('1','2','13','32','30','48','40','20','39','41','22','24');
$show=false;
for($b=0; $b<sizeof($allowed); $b++)
{
   if(in_array($allowed[$b], $user_info['groups']))
    $show=true;
}

if($show)
{
   if(isset($_GET['alpha']))
   {
      $name=$dire.'/'.$_GET['alpha'];
      $what=$_GET['alpha'];


      if(!file_exists($name))
         echo "File $what not found here";
      else
      {

         header('Content-Disposition: attachment; filename="' . $what . '"');
         //header('Content-Type: application/octet-stream');
         header('Content-Type: application/x-gzip');
         readfile($name);
      }
   }


   // read the directory
   $filer = array();
   if ($handle = opendir($dire))
   {
      while (false !== ($file = readdir($handle)))
      {
         if($file!= '.' && $file!='..' && $file!='.htaccess' )
                        {
                             $dato=substr($file,6);
                              $rt=substr($dato,3,2).substr($dato,0,2);
            $filer[] = $rt.'-'.$file;
                     
                        }
      }
      closedir($handle);
      sort($filer);
      $filer=array_reverse($filer);
   }
        $st=true;
   $max=0;
         foreach($filer as $al)
        {
         $max++;
         if($max<20)
          {
                   $al=substr($al,5);
                   $dato=substr($al,6);
                   $dt=substr($dato,0,2).'.'.substr($dato,3,2).'  20'.substr($dato,6,2);

      if($st)
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }

                 echo '<div style="margin: 10px 0 10px 0; background: #f9f9f9; padding: 10px; border: solid 1px #d0d0d0;">
    Latest release: <a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]
           

Changes:
      <pre style="font-size: 10px; font-family: verdana; margin: 0;">'.$changelog.'</div>';
                   $st=false;
                 }
                else
                {
 
                 // open the file and read the changelog!
                 $zip = zip_open($dire.'/'.$al);
                 if ($zip)
                {
                    while ($zip_entry = zip_read($zip))
                    {
                        if(zip_entry_name($zip_entry)=='changelog_TP.txt')
                       {
                            if (zip_entry_open($zip, $zip_entry, "r"))
                           {
                                $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                                $changelog2=substr($buf,0,strpos($buf,'1.0',5));
                                zip_entry_close($zip_entry);
                           }
                       }
                     }
                    zip_close($zip);
                     
               }
                   echo '<div><a href="index.php?page=86;alpha='.$al.'">TPv1.0 alpha</a> [ '.$dt.' ]</a>';
if($changelog2 != $changelog)
{
  echo '
Changes:
      <pre style="font-size: 10px; font-family: verdana; margin-top: 0;">'.$changelog2.'';
  $changelog=$changelog2;
}
echo '</div>';
               }
            }      
        }
}
else
  echo 'Sorry, no access.';
echo '</td></tr></table>';
No siggy! :D