Home Back
     
 

 

 

Basismap Intra- Internet programmeren
Categorie Programmeren Werken met POST en GET | Output_buffering
Werken met POST en GET

Bestandsbeheerder
DEMO :
http://www.tribuun.com/Kantoren/projectdemo/mod_dir/bestandsbeheer.php
Op deze server staat de "output_buffering af".Gezien dit voorbeeld ontworpen is voor "output_buffering aan" werkt het voorbeeld op deze server dus niet volledig.
Bekijk daarom ook het tweede voorbeeld dat speciaal is gemaakt indien je wil werken met "output_buffering af".

Nodige Bestanden

-Bestandsbeheer.php » hoofdbestand
-dir_class.php » klassenbestand

1.bestandsbeheer.php

 
Code:

<html>
<head>
<title>Bestandsbeheer</title>

<style>
.tabeltitel{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
color:#FFFFFF;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
}
.kolhoofd{
font-family:Verdana;
font-size:8pt;
background-color:#5B7B8B;
color:#FFFFFF;
cursor:hand;
border-bottom:1px solid #000000;
border-left 1px solid #000000;
border-right 1px solid #000000;
border-top:1px solid #000000;
letter-spacing: -1px;
}

.kolgeel{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#FFFFEB;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.kolgroen{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#D2ECD8;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}

.kolrood{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#FFECD1;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.kolblauw{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#BCCCD4;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.mini{
font-family: Verdana; 
border-bottom:1px solid #000000;
font-size: 10px;
letter-spacing: -1px;
}
 
.ingave{
border-style: solid;
border-width: 1px;
width: 250;
height:17;
font-size:8pt;
font-family:Tahoma;

.ingavekl{
border-style: solid;
border-width: 1px;
width: 100;
height:17;
font-size:8pt;
font-family:Tahoma;
}   
</style></head>

<body bgcolor="#E4E4E4"></body>

<?php

include ("dir_class.php"); 

switch ($_GET[handeling])
{
   case 'afhalen':
            $file = $oplaaddir . "/" . $_GET['file'];
            $filename = basename( $file );
            $len = filesize( $file );
            header( "content-type: application/stream" );
            header( "content-length: " . $len );
            header( "content-disposition: attachment; filename=" . $filename );
            $fp=fopen( $file, "r" );
            fpassthru( $fp );
            exit;
       case 'opladen':
            $file_array = $HTTP_POST_FILES['file'];
            $ingave = false;
            for($i = 0 ; $i < $aantbest; $i++)   //of  : $GLOBALS['aantbest']
            {
                 if($_FILES['file']['name'][$i])
                 {
                    $ingave = true;
                   if($_FILES['file']['name'][$i])
                      {
                        $bestand = $oplaaddir."/".$_FILES['file']['name'][$i];
                        move_uploaded_file($_FILES['file']['tmp_name'][$i],$bestand);
                        chmod($bestand,0777);
                        echo  $_FILES['file']['name'][$i]." opgeladen.<br>";

                      }
                 }
            }
            if(!$ingave) echo "Er zijn geen bestanden geselecteerd";
          exit;
   case 'verwijder':
            if(!@unlink($oplaaddir."/".$_GET['file']))
                 print "Bestand niet gevonden";
            else
                 print $_GET['file'] . " is verwijderd<br>";
      break;   // niet teruggaan met history goback >> oude pagina met niet verwijderde bestanden.
   case 'hernoem':
            rename( $oplaaddir . "/" . $_GET['file'] , $oplaaddir . "/" . $_GET['to'] );
            print "Bestand " . $_GET['file'] . " hernoemd tot " . $_GET['to'];

          Header("Location: " . $_SERVER['PHP_SELF'] );
      exit;
}


switch ($_POST[action]) {
   case 'demo menu':
      header("Location: http://www.tribuun.com/Kantoren/projectdemo/mod_menu/menu_vb.php ");
      break;
   case 'print globals':
      foreach( $GLOBALS as $key=>$value)
      {
             print "\$GLOBALS[\"$key\"] == $value<br>";
      }
      break;
   case 'toonbestanden':
      $Dir_1 = new dir;         // initiatie
      $Dir_1->ZetDirTitel($oplaaddir,"Bestandsbeheer");// dirpad + tabeltitel

      $Dir_1->ZetKol("Bestandsnaam");     // kolomtitel
      $Dir_1->ZetKol(" Grootte");            // kolomtitel
      $Dir_1->ZetKol(" v");               // kolomtitel
      $Dir_1->ZetKol(" a");                // kolomtitel
      $Dir_1->ZetKol(" h");               // kolomtitel
      $Dir_1->ZetKol(" o");            // kolomtitel
 

      $Dir_1->ZetStijl("class='tabeltitel'");   //[0] Zonder achtergrondkleur » voor de werking van de oplichtband
      $Dir_1->ZetStijl("class='tabeltitel'");   //[1]
      $Dir_1->ZetStijl("class='kolhoofd'");   //[2]
      $Dir_1->ZetStijl("class='kolgeel'");   //[3]
      $Dir_1->ZetStijl("class='kolgroen'");   //[4]
      $Dir_1->ZetStijl("class='kolrood'");   //[5]
      $Dir_1->ZetStijl("class='kolblauw'");   //[6]
      $Dir_1->ZetStijl("class='mini'");   //[7]
      $Dir_1->ZetAG_tabel("align='left' valign='top' width='580' bgcolor='#638697'");
      $Dir_1->ZetAG_td("bgcolor='#638697'");

      $Dir_1->MaakHtml();      // geef de records weer
 

      break;

   default:
      echo "Start pagina Bestandsberheerder";

      $Opladen_1 = new opladen;         // initiatie
      $Opladen_1->ZetStijl("class='tabeltitel'");   //[0]
      $Opladen_1->ZetStijl("class='ingave'");   //[1]
      $Opladen_1->ZetStijl("class='ingavekl'");   //[2]

      $Opladen_1->MaakHtml();

      break;
}
?>
</body></html>
 


2.dir_class.php

 
Code:

<?php
$_POST    = $HTTP_POST_VARS;
$_GET     = $HTTP_GET_VARS;
$aantbest = 2 ;
$oplaaddir = "testen";
$action = ($HTTP_POST_VARS['name']);


//_____________ 1. De Klasse dir configureren __________________________________________________________
class dir {
    var $tabel;               
    var $titel;
    var $ophaaldir;              // om verschillende menus kunnen weer te geven
    var $Kol = array();
    var $KolNaam  = array();
    var $entry;           
    var $AG_tabel;             // waarden gezet in TD
    var $AG_td;             // rij waar de lichtband niet moet oplichten;
    var $Stijl = array();


    //______________________________ Klasse-functie : Tabelnaam opgeven _________________________________
   
    function ZetDirTitel($dir,$titel) {
        $this->titel = $titel;
        $this->ophaaldir= $dir;
    }


    //______________________________ Klasse-functie : Kolom en Kolomhoofding _____________________________

    function ZetKol($omschrijving) {
        $this->KolNaam[] = $omschrijving;
    }
    //______________________________ Klasse-functie : stijlen ____________________________________________

    function ZetStijl($stijlen) {
        $this->Stijl[] = $stijlen;
    }       
    function ZetAG_tabel($html) {
        $this->AG_tabel = $html;
    }
    function ZetAG_td($html) {
        $this->AG_td = $html;
    }   

    //______________________________ Klasse-functie : Maak de html-code __________________________________

    function MaakHtml() {

      if (!$handle = @opendir($this->ophaaldir))
      {
         print "
         <span>
         Kan ". $oplaaddir . " niet openen. Kijk na of de map bestaat of controleer de eigenschappen van de map.
         </span>
         ";
        }
        print "
           <p>".$this->titel."</p>
           <table><tr>
           <td ".$this->Stijl[3].">".$this->KolNaam[0]."</td>
           <td ".$this->Stijl[3].">".$this->KolNaam[1]."</td>
           <td ".$this->Stijl[3].">".$this->KolNaam[2]."</td>
           <td ".$this->Stijl[3].">".$this->KolNaam[3]."</td>
           <td ".$this->Stijl[3].">".$this->KolNaam[4]."</td>                      
           <td ".$this->Stijl[3].">".$this->KolNaam[5]."</td></tr>
           ";

           while($entry = @readdir($handle))
              {
                if($entry != ".." && $entry != "." && !is_dir($entry))
                {
                  //Set the filesize type (bytes, KiloBytes of MegaBytes)
                  $filesize = filesize($this->ophaaldir . "/" . $entry);
                  $type = Array ('B', 'KB', 'MB');
                  for ($i = 0; $filesize > 1024; $i++)
                    $filesize /= 1024;
                    if($filesize  <= 0){
                   $filesize="dir" ;
               } else {
                   $filesize = round ($filesize, 2)." $type[$i]";
               }

                  print "<TBODY ONMOUSEOVER='lichtband(true)' ONMOUSEOUT='lichtband(false)'>";   
                print "<tr>";
                    print "<td ".$this->Stijl[7].">".$entry."</td>";            
                    print "<td ".$this->Stijl[7].">".$filesize."</td>";
                    print "<td ".$this->Stijl[3]." width='15'>";
               ?><A href="javascript:if(confirm('Verwijder <?=$entry;?>?')) location.href='<?=$_SERVER['PHP_SELF'];?>?handeling=verwijder&amp;file=<?=$entry;?>';"><?
               print "<img src='pic1.gif' alt='Verwijder ".$entry."' width=15 height=15 border=0></a></td>";
                    print "<td ".$this->Stijl[4]." width='15'>";
               print "<A href=".$_SERVER['PHP_SELF']."?handeling=afhalen&file=".$entry." >";
               print "<img src='pic2.gif' alt='Afhalen ".$entry."' width=15 height=15 border=0></a></td>";
                    print "<td ".$this->Stijl[5]." width='15'>"
                  ?><A href="javascript: var inserttext = ''; if(inserttext = prompt('Hernoem <?=$entry;?>. Geef een nieuwe naam op voor het bestand.','<?=$entry;?>')) location.href='<?=$_SERVER['PHP_SELF'];?>?handeling=hernoem&amp;file=<?=$entry;?>&amp;to='+inserttext; "><?
               print "<img src='pic3.gif' alt='Hernoem ".$entry."' width=15 height=15 border=0></a></td>";
                    print "<td ".$this->Stijl[6]." width='15'>";
               print "<a href='".$GLOBALS[oplaaddir]."/".$entry."' target='_blank' >";
               print "<img src='pic4.gif' alt='Openen ".$entry."' width=15 height=15 border=0></a></td>";
                 print "</tr>";
                 print "</TBODY>";                }
                }
      print "</table>";
   
   }
}

//_____________ 1. De Klasse opladen configureren __________________________________________________________
class opladen {
             
    var $AG_tabel;         // waarden gezet in hoofdtabel
    var $AG_td;            // dient niet noodzakelijk gezet te worden.
    var $Stijl = array();    // te zetten klassen » indien gewenst

    //______________________________ Klasse-functie : stijlen ____________________________________________

    function ZetStijl($stijlen) {
        $this->Stijl[] = $stijlen;
    }       
    function ZetAG_tabel($html) {
        $this->AG_tabel = $html;
    }
    function ZetAG_td($html) {
        $this->AG_td = $html;
    }   

    //______________________________ Klasse-functie : Maak de html-code __________________________________

    function MaakHtml() {

   print "
      <form method='post' enctype='multipart/form-data' action='".$_SERVER['PHP_SELF']."?handeling=opladen'?>
      <table>
      ";      
   for( $i = 0; $i < $GLOBALS['aantbest']; $i++ )
   { 
   print "
      <tr>
      <td>
      <input type='file' name='file[]' ".$this->Stijl[1]."></td>
      </tr>
      ";
   }
   print "
      <tr>
      <td>
      <input type='submit' value='Opladen' ".$this->Stijl[1]."><br>
      </td></tr></table>
      </form>
      <form method='post'>
      <table>
      <tr><td>
      <input type='submit' value='toonbestanden' name='action' ".$this->Stijl[2].">
      </td></tr>
      <tr><td>
      <input type='submit' value='demo menu' name='action' ".$this->Stijl[2].">
      <input type='submit' value='print globals' name='action' ".$this->Stijl[2].">
      </td></tr>      
      </form>
      ";
   }
}



//______________ Java functies and stijlen _______________________________
?>

<script language="javascript">
/* voor het uitklappen van de contents */
var ns6=document.getElementById&&!document.all?1:0

function haalelement(el) {
    var tagList = new Object
    for (var i = 1; i < arguments.length; i++)
      tagList[arguments[i]] = true
    while ((el!=null) && (tagList[el.tagName]==null))
      el = el.parentElement     
    return el
  }

function lichtband(janee) {
    var el = haalelement(event.srcElement,"TD")
    if (el==null) return
    if ((el.tagName=="TD")) {
      var rij = haalelement(el, "TR")
      if (janee)
        rij.className = "rijover"
      else
        rij.className = ""
                    }
  }
</script>
<style>
.rijover {background-color:#5B7B8B;color:#FFFFFF;cursor:hand;}

</style>
<?
 


 

BerichtGeplaatst: Zo Aug 01, 2004 5:53 pm    Onderwerp: output_buffering OFF  

Bestandsbeheerder output_buffering uitgeschakeld.

Bestanden
- bestandsbeheer_off.php
- dir_class_off.php

Demo
http://www.tribuun.com/Kantoren/projectdemo/mod_dir/bestandsbeheer_off.php

1.bestandsbeheer_off.php
 
Code:

<html>
<head>
<title>Bestandsbeheer</title>

<style>
.tabeltitel{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
color:#FFFFFF;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
}
.kolhoofd{
font-family:Verdana;
font-size:8pt;
background-color:#5B7B8B;
color:#FFFFFF;
cursor:hand;
border-bottom:1px solid #000000;
border-left 1px solid #000000;
border-right 1px solid #000000;
border-top:1px solid #000000;
letter-spacing: -1px;
}

.kolgeel{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#FFFFEB;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.kolgroen{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#D2ECD8;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}

.kolrood{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#FFECD1;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.kolblauw{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#BCCCD4;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.mini{
font-family: Verdana; 
border-bottom:1px solid #000000;
font-size: 10px;
letter-spacing: -1px;
}
 
.ingave{
border-style: solid;
border-width: 1px;
width: 250;
height:17;
font-size:8pt;
font-family:Tahoma;

.ingavekl{
border-style: solid;
border-width: 1px;
width: 100;
height:17;
font-size:8pt;
font-family:Tahoma;
}   
</style></head>

<body bgcolor="#E4E4E4"></body>

<?php

include ("dir_class_off.php"); 

switch ($_GET[handeling])
{
       case 'opladen':
            $file_array = $HTTP_POST_FILES['file'];
            $ingave = false;
            for($i = 0 ; $i < $aantbest; $i++)   //of  : $GLOBALS['aantbest']
            {
                 if($_FILES['file']['name'][$i])
                 {
                    $ingave = true;
                   if($_FILES['file']['name'][$i])
                      {
                        $bestand = $oplaaddir."/".$_FILES['file']['name'][$i];
                        move_uploaded_file($_FILES['file']['tmp_name'][$i],$bestand);
                        chmod($bestand,0777);
                        echo  $_FILES['file']['name'][$i]." opgeladen.<br>";

                      }
                 }
            }
            if(!$ingave) echo "Er zijn geen bestanden geselecteerd";
      print "$GLOBALS[startlocatie]"; // buffering off
      print  "<br>Headers verwijderen na send met de schakel:'Terug'";
          exit;
   case 'verwijder':
            if(!@unlink($oplaaddir."/".$_GET['file']))
                 print "Bestand niet gevonden";
            else
      {
                 print $_GET['file'] . " is verwijderd<br>";
      }
      print "$GLOBALS[startlocatie]"; // buffering off
      print  "<br>Headers verwijderen na send met de schakel:'Terug'";
      exit;
   case 'hernoem':
            rename( $oplaaddir . "/" . $_GET['file'] , $oplaaddir . "/" . $_GET['to'] );
            print "Bestand " . $_GET['file'] . " hernoemd tot " . $_GET['to'];
      print "$GLOBALS[startlocatie]"; // buffering off
      exit;
}


switch ($_POST[action]) {
   case 'demo menu':
      print "a href=\"http://www.tribuun.com/Kantoren/projectdemo/mod_menu/menu_vb.php\">";
      break;
   case 'print globals':
      foreach( $GLOBALS as $key=>$value)
      {
             print "\$GLOBALS[\"$key\"] == $value<br>";
      }
      break;
   case 'print settings':
        define('boolean', 1);
        define('string', 2);
        define('integer', 3);

        $php_ini_all = Array(
          Array(string, 'arg_separator.input'),
          Array(string, 'arg_separator.output'),
          Array(boolean, 'display_errors'),
          Array(boolean, 'display_startup_errors'),
          Array(boolean, 'magic_quotes_runtime'),
          Array(integer, 'error_reporting'),
          Array(string, 'variables_order'),
          Array(string, 'gpc_order')
        );

        $php_ini_perdir = Array(
          Array(boolean, 'asp_tags'),
          Array(boolean, 'magic_quotes_gpc'),
          Array(string, 'output_buffering'),
          Array(boolean, 'register_globals'),
          Array(boolean, 'short_open_tag')
        );
      ?>

      <?php
        function display_php_conf() {
            foreach ( $GLOBALS['php_ini_all'] as $option ) {
               $value = ini_get($option[1]);
               echo "ini_set('$option[1]', '$value');<br>";
             }
        }

        function display_htaccess_conf() {
          global $php_ini_all, $php_ini_perdir;

          foreach ( array_merge($php_ini_all, $php_ini_perdir) as $option ) {
            $value = ini_get($option[1]);

           if ( $option[0] == boolean ) {
                 $value = $value ? 'on' : 'off';
                 $directive = 'php_flag';
            } else {
                 $directive = 'php_value';
               }

               echo "$directive $option[1] $value<br>";
             }
        }


        header('Content-type: text/plain');

        echo "PHP settings:<br>";
        display_php_conf();

        echo "<br>.htaccess settings:<br>";
        display_htaccess_conf();

      break;


   default:
      print "<font face=\"Verdana\" size=\"2\">Opladen bestanden naar map ".$GLOBALS[oplaaddir]."</font>";

      $Opladen_1 = new opladen;         // initiatie
      $Opladen_1->ZetStijl("class='tabeltitel'");   //[0]
      $Opladen_1->ZetStijl("class='ingave'");   //[1]
      $Opladen_1->ZetStijl("class='ingavekl'");   //[2]

      $Opladen_1->MaakHtml();

      $Dir_1 = new dir;         // initiatie
      $Dir_1->ZetDirTitel($oplaaddir,"<font face=\"Verdana\" size=\"2\">Bestandslijst</font><hr>");// dirpad + tabeltitel

      $Dir_1->ZetKol("Bestandsnaam");     // kolomtitel
      $Dir_1->ZetKol(" Grootte");            // kolomtitel
      $Dir_1->ZetKol(" v");               // kolomtitel 
      $Dir_1->ZetKol(" h");               // kolomtitel
      $Dir_1->ZetKol(" o");            // kolomtitel
 

      $Dir_1->ZetStijl("class='tabeltitel'");   //[0] Zonder achtergrondkleur » voor de werking van de oplichtband
      $Dir_1->ZetStijl("class='tabeltitel'");   //[1]
      $Dir_1->ZetStijl("class='kolhoofd'");   //[2]
      $Dir_1->ZetStijl("class='kolgeel'");   //[3]
      $Dir_1->ZetStijl("class='kolgroen'");   //[4]
      $Dir_1->ZetStijl("class='kolrood'");   //[5]
      $Dir_1->ZetStijl("class='kolblauw'");   //[6]
      $Dir_1->ZetStijl("class='mini'");   //[7]
      $Dir_1->ZetAG_tabel("align='left' valign='top' width='580' bgcolor='#638697'");
      $Dir_1->ZetAG_td("bgcolor='#638697'");

      $Dir_1->MaakHtml();      // geef de records weer
 

      break;
}
?>
</body></html>
 


2.dir_class_off.php
 
Code:

<?php
$_POST    = $HTTP_POST_VARS;
$_GET     = $HTTP_GET_VARS;
$aantbest = 2 ;
$oplaaddir = "testen";
$startlocatie = "<br><a href=\"http://www.tribuun.com/Kantoren/projectdemo/mod_dir/bestandsbeheer_off.php\">Terug</a>";

$action = ($HTTP_POST_VARS['name']);


//_____________ 1. De Klasse dir configureren __________________________________________________________
class dir {
    var $tabel;               
    var $titel;
    var $ophaaldir;              // om verschillende menus kunnen weer te geven
    var $Kol = array();
    var $KolNaam  = array();
    var $entry;           
    var $AG_tabel;             // waarden gezet in TD
    var $AG_td;             // rij waar de lichtband niet moet oplichten;
    var $Stijl = array();


    //______________________________ Klasse-functie : Tabelnaam opgeven _________________________________
   
    function ZetDirTitel($dir,$titel) {
        $this->titel = $titel;
        $this->ophaaldir= $dir;
    }


    //______________________________ Klasse-functie : Kolom en Kolomhoofding _____________________________

    function ZetKol($omschrijving) {
        $this->KolNaam[] = $omschrijving;
    }
    //______________________________ Klasse-functie : stijlen ____________________________________________

    function ZetStijl($stijlen) {
        $this->Stijl[] = $stijlen;
    }       
    function ZetAG_tabel($html) {
        $this->AG_tabel = $html;
    }
    function ZetAG_td($html) {
        $this->AG_td = $html;
    }   

    //______________________________ Klasse-functie : Maak de html-code __________________________________

    function MaakHtml() {

      if (!$handle = @opendir($this->ophaaldir))
      {
         print "
         <span>
         Kan ". $oplaaddir . " niet openen. Kijk na of de map bestaat of controleer de eigenschappen van de map.
         </span>
         ";
        }
        print "
           <p>".$this->titel."</p>
           <table><tr>
           <td ".$this->Stijl[4].">".$this->KolNaam[0]."</td>
           <td ".$this->Stijl[4].">".$this->KolNaam[1]."</td>
           <td ".$this->Stijl[4].">".$this->KolNaam[2]."</td>
           <td ".$this->Stijl[4].">".$this->KolNaam[4]."</td>                      
           <td ".$this->Stijl[4].">".$this->KolNaam[5]."</td></tr>
           ";

           while($entry = @readdir($handle))
              {
                if($entry != ".." && $entry != "." && !is_dir($entry))
                {
                  //Set the filesize type (bytes, KiloBytes of MegaBytes)
                  $filesize = filesize($this->ophaaldir . "/" . $entry);
                  $type = Array ('B', 'KB', 'MB');
                  for ($i = 0; $filesize > 1024; $i++)
                    $filesize /= 1024;
                    if($filesize  <= 0){
                   $filesize="dir" ;
               } else {
                   $filesize = round ($filesize, 2)." $type[$i]";
               }

                  print "<TBODY ONMOUSEOVER='lichtband(true)' ONMOUSEOUT='lichtband(false)'>";   
                print "<tr>";
                    print "<td ".$this->Stijl[7].">".$entry."</td>";            
                    print "<td ".$this->Stijl[7].">".$filesize."</td>";
                    print "<td ".$this->Stijl[3]." width='15'>";
               ?><A href="javascript:if(confirm('Verwijder <?=$entry;?>?')) location.href='<?=$_SERVER['PHP_SELF'];?>?handeling=verwijder&amp;file=<?=$entry;?>';"><?
               print "<img src='pic1.gif' alt='Verwijder ".$entry."' width=15 height=15 border=0></a></td>";
                    print "<td ".$this->Stijl[5]." width='15'>"
                  ?><A href="javascript: var inserttext = ''; if(inserttext = prompt('Hernoem <?=$entry;?>. Geef een nieuwe naam op voor het bestand.','<?=$entry;?>')) location.href='<?=$_SERVER['PHP_SELF'];?>?handeling=hernoem&amp;file=<?=$entry;?>&amp;to='+inserttext; "><?
               print "<img src='pic3.gif' alt='Hernoem ".$entry."' width=15 height=15 border=0></a></td>";
                    print "<td ".$this->Stijl[6]." width='15'>";
               print "<a href='".$GLOBALS[oplaaddir]."/".$entry."' target='_blank' >";
               print "<img src='pic4.gif' alt='Openen | Afhalen ".$entry."' width=15 height=15 border=0></a></td>";
                 print "</tr>";
                 print "</TBODY>";                }
                }
      print "</table>";
   
   }
}

//_____________ 1. De Klasse opladen configureren __________________________________________________________
class opladen {
             
    var $AG_tabel;         // waarden gezet in hoofdtabel
    var $AG_td;            // dient niet noodzakelijk gezet te worden.
    var $Stijl = array();    // te zetten klassen » indien gewenst

    //______________________________ Klasse-functie : stijlen ____________________________________________

    function ZetStijl($stijlen) {
        $this->Stijl[] = $stijlen;
    }       
    function ZetAG_tabel($html) {
        $this->AG_tabel = $html;
    }
    function ZetAG_td($html) {
        $this->AG_td = $html;
    }   

    //______________________________ Klasse-functie : Maak de html-code __________________________________

    function MaakHtml() {

   print "
      <form method='post'>
      <table>
      <tr><td><font face=\"Verdana\" size=\"2\">Extra Demo Menu</font>
      <input type='submit' value='demo menu' name='action' ".$this->Stijl[2].">
      <input type='submit' value='print globals' name='action' ".$this->Stijl[2].">
      <input type='submit' value='print settings' name='action' ".$this->Stijl[2].">
      </td>
      </table>      
      </form>
   
      <form method='post' enctype='multipart/form-data' action='".$_SERVER['PHP_SELF']."?handeling=opladen'?>
      <table>
      ";      
   for( $i = 0; $i < $GLOBALS['aantbest']; $i++ )
   { 
   print "
      <tr>
      <td>
      <input type='file' name='file[]' ".$this->Stijl[1]."></td>
      </tr>
      ";
   }
   print "
      <tr>
      <td>
      <input type='submit' value='Opladen' ".$this->Stijl[1]."><br>
      </td></tr></table>
      </form>
      ";
   }
}



//______________ Java functies and stijlen _______________________________
?>

<script language="javascript">
/* voor het uitklappen van de contents */
var ns6=document.getElementById&&!document.all?1:0

function haalelement(el) {
    var tagList = new Object
    for (var i = 1; i < arguments.length; i++)
      tagList[arguments[i]] = true
    while ((el!=null) && (tagList[el.tagName]==null))
      el = el.parentElement     
    return el
  }

function lichtband(janee) {
    var el = haalelement(event.srcElement,"TD")
    if (el==null) return
    if ((el.tagName=="TD")) {
      var rij = haalelement(el, "TR")
      if (janee)
        rij.className = "rijover"
      else
        rij.className = ""
                    }
  }
</script>
<style>
.rijover {background-color:#5B7B8B;color:#FFFFFF;cursor:hand;}

</style>
<?

 



 

BerichtGeplaatst: Zo Aug 08, 2004 9:08 am    Onderwerp: Output-buffering  

Als php outputbuffering niet ingesteld is kan je ook ob_functies gebruiken om het header reeds verzonden probleem te omzeilen.

 
Code:

ob_start();
     php code ...
     header('Content-Length: ' . ob_get_length());
ob_end_flush();
 

 

 

Copyright (c) 2005 :: willems piet