albumsysteem met volledige php sturing 
                    
                    Auteur: biertie Dennisvb  
                    
                        
		
		
		 Dit is een foto album waar ik een toevoeg pagina aan gemaakt heb. album.php komt van Webbie XL.
Functies van het Album.
Het album bestaat uit 2 delen.
- album.php
- albumlijst.php
- albumtoevoegen.php
- config.php
Album.php werkt heel simpel. 
Je moet je map met foto's uploaden naar je server. Deze map is direct al het album.
Het enige wat je dan nog moet doen, is het album toevoegen in albumtoevoegen.php. makkelijker kan het niet 
belangrijk: ik heb ik het script aangepast daj je pagina= moet hebben, tis maar dat ge het weet [met die include toestanden enzo. $_GET['pagina'] met je dan doen
album zorgt ervoor dat alle foto's als thumbnails te voorschijn komen in je album. Deze thumbnails dienen dan ook als link om naar de foto zelf te gaan.
het reactie systeem heb ik er ook ingelaten, voor de liefhebbers 
.
later komt er maak ik er nog een albumverander.php pagina bij, zodat je dingen aan je albumlijst kan veranden, en een albumverwijder.php bij.
nog later zorg ik ervoor dat je je foto's een titel kan meegeven, en als het mij ook ooit lukt op thumbnails eenvoudig te laten inladen, en die dan te linken met de originele foto, zal ik dat ook nog eens doen, dat zal in ieder geval de snelheid ten goed komen 
.
Hope you enjoy it!
Biertie
 
                     
                     
                
                
                    
                    Code:  
                    
                    
                    MySQL databases:
    
    
        
            
                
CREATE TABLE fotos (
  id tinyint(4) NOT NULL auto_increment,
  naam varchar(20) NOT NULL default '',
  albumurl varchar(11) NOT NULL default '',
  uitleg text NOT NULL,
  albumfotovb varchar(50) NOT NULL default '',
  PRIMARY KEY  (id)
) TYPE=MyISAM;
-------------------------------------
CREATE TABLE fotosreacties (
  id int(11) NOT NULL auto_increment,
  boek varchar(60) NOT NULL default '',
  foto varchar(60) NOT NULL default '',
  naam varchar(30) NOT NULL default '',
  datum int(11) NOT NULL default '0',
  reactie text NOT NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;  
             
            CREATE TABLE fotos ( 
  id tinyint( 4 )  NOT NULL  auto_increment, 
  naam varchar( 20 )  NOT NULL  default  '' , 
  albumurl varchar( 11 )  NOT NULL  default  '' , 
  uitleg text NOT NULL , 
  albumfotovb varchar( 50 )  NOT NULL  default  '' , 
)  TYPE= MyISAM; 
 
------------------------------------- 
 
CREATE TABLE fotosreacties ( 
  id int( 11 )  NOT NULL  auto_increment, 
  boek varchar( 60 )  NOT NULL  default  '' , 
  foto varchar( 60 )  NOT NULL  default  '' , 
  naam varchar( 30 )  NOT NULL  default  '' , 
  datum int( 11 )  NOT NULL  default  '0' , 
  reactie text NOT NULL , 
)  TYPE= MyISAM; 
 
         
     
 
    
    
        
            
                <?php
	mysql_connect ("localhost", "gebruikersnaam", "paswoord");
	mysql_select_db ("databasenaam");
	$max = 8; // het maximaal aantal album's op een pagina.
	$aantalFotos = 18; // aantal fotos per pagina 
?> 
             
            <?php 
	$max  =  8 ;  // het maximaal aantal album's op een pagina. 
	$aantalFotos  =  18 ;  // aantal fotos per pagina  
?> 
 
         
     
 
    
    
        
            
                <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 
<?php 
ob_start();
include ("config.php"); 
//Als men op Submit gedrukt heeft 
if ($_POST['Submit']) { 
//We gaan controleren of alle velden zijn ingevuld en dat e-mailadres bestaat 
	if (!trim($_POST['naam']))
		{ 
    		$error="Je moet je naam voor het album invullen"; 
		}
	elseif(!trim($_POST['albumurl'])) 
		{
    		$error.="Je moet de map waar de foto's instaan invullen<br>"; 
		}
	elseif(!trim($_POST['albumfotovb']))
		{
			$error.="je moet een voorbeeld foto ingeven<br>";
		}
	elseif (!trim($_POST['uitleg'])) 
		{
    		$error.="je moet uileg geven over je album<br>"; 
		}
//Als er een veld niet is ingevuld komt er een error 
if(isset($error)) {
          
?>
<center> <table class=\"fotos\" width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">
 <tr>
   <td align=\"center\">
   <b><?php echo".$error."; ?> </b>
    <br>
    <form method=\"post\" action=\"javascript:history.go(-1)\">
     <input type=\"submit\" name=\"Terug\" value=\"Terug\">
     </form>
    </td>
   </tr>
 </table>
</center>
<?
//Als alles correct is ingevuld gaan we over naar het posten van de gegevens naar de database 
	} 
else 
	{
 		$naam = addslashes(htmlspecialchars($_POST['naam']));
 		$albumurl = addslashes(htmlspecialchars($_POST['albumurl']));
 		$uitleg = addslashes(htmlspecialchars($_POST['uitleg']));
 		$albumfotovb = addslashes(htmlspecialchars($_POST['albumfotovb']));
	$query= "INSERT INTO fotos (naam, albumurl, uitleg, albumfotovb)
	VALUES ('".$naam."', '".$albumurl."', '".$uitleg."', '".$albumfotovb."')";
	mysql_query($query) or die (mysql_error());
?>
		<p>het album is succesvol toegevoegd!</p>
		<p><a href="albumtoevoegen.php">klik hier om nog een album toe te voegen</a><br>
	      <a href="albumlijst.php">klik hier om de albumlijst te bezichtigen</a></p>
		
		  <?php
	} 
	}
else
{
//Als men nog niet op Submit gedrukt heeft krijgt men natuurlijk het formulier te zien 
?>
                        </p>
		<center> 
  <form name="fotos" action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"> 
    <table class="fotos" width="100%" border="1" cellspacing="0" cellpadding="2"> 
      <tr> 
        <td height="20" colspan="2"><strong>album toevoegen op de site: </strong></td> 
      </tr> 
      <tr> 
        <td width="44%">Naam album:</td> 
        <td width="56%"> 
          <input name="naam" type="text" id="naam"  size="30" maxlength="50"> 
        </td> 
      </tr> 
      <tr> 
        <td align="left" valign="top">url naar map album: (gewoon de naam van de map noemen)</td> 
        <td> 
          <input name="albumurl" type="text" id="albumurl" size="30" maxlength="50"></td> 
      </tr> 
      <tr> 
        <td>voorbeeldfoto: (+naam van de map! vb: map1/foto1.jpg) </td> 
        <td> 
          <input name="albumfotovb" type="text" id="albumfotovb"  size="30" maxlength="50">             
        </td> 
      </tr> 
      <tr> 
        <td colspan="2"><div align="left">uitleg:<br> 
            <textarea name="uitleg" cols="50" rows="7" id="uitleg"></textarea>          
            <br>        
          </div>          </td> 
      </tr> 
      <tr> 
        <td height="25" colspan="2" align="center"> 
          <input type="submit" name="Submit" value="Verzenden">                
          <input name="Reset" type="submit" id="Reset" value="Opnieuw"> 
        </td> 
      </tr> 
    </table> 
  </form> 
</center> 
<?php 
} 
?> 
             
            <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 
<?php  
 
include  ( "config.php" ) ;  
 
//Als men op Submit gedrukt heeft  
if  ( $_POST [ 'Submit' ] )  {  
 
//We gaan controleren of alle velden zijn ingevuld en dat e-mailadres bestaat  
 
	if  ( ! trim ( $_POST [ 'naam' ] ) )  		{  
    		$error = "Je moet je naam voor het album invullen" ;  
		} 
	elseif ( ! trim ( $_POST [ 'albumurl' ] ) )   		{ 
    		$error .= "Je moet de map waar de foto's instaan invullen<br>" ;  
		} 
	elseif ( ! trim ( $_POST [ 'albumfotovb' ] ) )  		{ 
			$error .= "je moet een voorbeeld foto ingeven<br>" ; 
		} 
	elseif  ( ! trim ( $_POST [ 'uitleg' ] ) )   		{ 
    		$error .= "je moet uileg geven over je album<br>" ;  
		} 
//Als er een veld niet is ingevuld komt er een error  
 
 
?> 
<center> <table class=\"fotos\" width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\">
 <tr>
   <td align=\"center\">
   <b>
<?php  echo ".$error ." ;  ?>  </b>
    <br>
    <form method=\"post\" action=\"javascript:history.go(-1)\">
     <input type=\"submit\" name=\"Terug\" value=\"Terug\">
     </form>
    </td>
   </tr>
 </table>
</center>
<? 
//Als alles correct is ingevuld gaan we over naar het posten van de gegevens naar de database  
	}  
else  
	{ 
	$query =  "INSERT INTO fotos (naam, albumurl, uitleg, albumfotovb) 
	VALUES ('" . $naam . "', '" . $albumurl . "', '" . $uitleg . "', '" . $albumfotovb . "')" ; 
?> 
		<p>het album is succesvol toegevoegd!</p>
		<p><a href="albumtoevoegen.php">klik hier om nog een album toe te voegen</a><br>
	      <a href="albumlijst.php">klik hier om de albumlijst te bezichtigen</a></p>
 
		  <?php 
	}  
 
	} 
else 
{ 
//Als men nog niet op Submit gedrukt heeft krijgt men natuurlijk het formulier te zien  
?> 
                        </p>
		<center> 
  <form name="fotos" action="
<?  echo $_SERVER [ 'PHP_SELF' ] ;  ?> " method="post"> 
    <table class="fotos" width="100%" border="1" cellspacing="0" cellpadding="2"> 
      <tr> 
        <td height="20" colspan="2"><strong>album toevoegen op de site: </strong></td> 
      </tr> 
      <tr> 
        <td width="44%">Naam album:</td> 
        <td width="56%"> 
          <input name="naam" type="text" id="naam"  size="30" maxlength="50"> 
        </td> 
      </tr> 
      <tr> 
        <td align="left" valign="top">url naar map album: (gewoon de naam van de map noemen)</td> 
        <td> 
          <input name="albumurl" type="text" id="albumurl" size="30" maxlength="50"></td> 
      </tr> 
      <tr> 
        <td>voorbeeldfoto: (+naam van de map! vb: map1/foto1.jpg) </td> 
        <td> 
          <input name="albumfotovb" type="text" id="albumfotovb"  size="30" maxlength="50">             
        </td> 
      </tr> 
      <tr> 
        <td colspan="2"><div align="left">uitleg:<br> 
            <textarea name="uitleg" cols="50" rows="7" id="uitleg"></textarea>          
            <br>        
          </div>          </td> 
      </tr> 
      <tr> 
        <td height="25" colspan="2" align="center"> 
          <input type="submit" name="Submit" value="Verzenden">                
          <input name="Reset" type="submit" id="Reset" value="Opnieuw"> 
        </td> 
      </tr> 
    </table> 
  </form> 
</center> 
<?php  
}  
?> 
 
         
     
 
    
    
        
            
                <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 
<?php 
include ("config.php"); 
 
<br> 
#### Begin Navigatie code #### 
$query = mysql_query("SELECT id FROM fotos ORDER BY id DESC") or die(mysql_error()); 
$aantal = mysql_num_rows($query); 
$aantal/=$max; 
      
if ($aantal == 0) { 
    echo "<div align=center>Er zijn nog <b>geen album's</b> op deze site!</div>"; 
} else { 
	$nav=$_GET['nav']; 
		if (empty($nav)) { 
    						$nav=1; 
						} 
		$van=($nav-1)*$max; 
		if ($nav > ceil($aantal)) { 
    						$nav=1; 
						} 
          
		for ($i = 1; $i <= ceil($aantal); $i++) { 
   							 if ($nav == $i) 
        						$navs[$i] = "<b>$i</b>"; 
   							 else 
      							  $navs[$i] = "<a href=\"lezen.php?nav=$i\">$i</a>"; 
						} 
          
		$navs= implode(" | ", $navs); 
              
		$vorige = ($nav-1) ? "<a href=\"index.php?pagina=albumlijst&nav=" . ($nav - 1) . "\">< Vorige</a>" : ""; 
		$volgende = ($nav-ceil($aantal)) ? "<a href=\"index.php?pagina=albumlijst&nav=" . ($nav + 1) . "\">Volgende ></a>" : ""; 
		if ($vorige && $volgende) { 
    						$navigatie = $vorige." | ".$navs ." | ".$volgende; 
						} 
					else { 
   		 $navigatie = $vorige." | ".$navs." | ".$volgende; 
		} 
//Einde Navigatie code
	}
//Nu gaan we de albums selecteren 
$query=mysql_query("SELECT * FROM fotos ORDER BY id DESC LIMIT $van, $max") or die (mysql_error());
//Nu worden alle berichten weergegeven dmv een while 
    while ($obj = mysql_fetch_object($query)) { 
    //nl2br() zorgt er voor dat er bij elke enter ook een nieuwe lijn komt 
        $uitleg=nl2br($uitleg);
?> 
<table class="fotos" width="100%" border="0" cellspacing="0" cellpadding="2"> 
  <tr> 
    <td colspan="2" valign="top"> 
      <strong>naam album </strong>: <span class="style1">
      <?=$obj->naam?> 
      </span></td> 
  </tr> 
  <tr> 
    <td width="11%" rowspan="2" valign="top"> 
        <a href="index.php?pagina=album&boek=<?=$obj->albumurl?>"><img src="<?=$obj->albumfotovb?>" height="100" border="0"></a>
    </td> 
    <td width="89%" height="73" valign="top"><p>
        <?=$obj->uitleg?>
    </a></p>
    <p align="center"> </p></td>
  </tr>
  <tr>
    <td valign="top"><div align="center">>><a href="index.php?pagina=album&boek=<?=$obj->albumurl?>" class="style2">bekijk het album</a> </div></td>
  </tr>
  <tr>
    <td colspan="2" valign="top"><hr></td>
  </tr> 
</table> 
<br> 
<?php
//Deze loop wordt herhaald tot dat alle berichten zijn weergegeven
}
?> 
<br> 
<table class="fotos" width="100%" border="1" cellspacing="0" cellpadding="1"> 
  <tr> 
    <td align="center" height="19"><?=$navigatie?></td> 
  </tr> 
</table> 
<br>  
             
            <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 
<?php  
include  ( "config.php" ) ;  
 
< br>  
#### Begin Navigatie code ####  
$aantal /= $max ;  
 
if  ( $aantal  ==  0 )  {  
    echo "<div align=center>Er zijn nog <b>geen album's</b> op deze site!</div>" ;   }  else  {  
 
	$nav = $_GET [ 'nav' ] ;  
    						$nav = 1 ;  
						}  
		$van = ( $nav - 1 ) * $max ;  
 
		if  ( $nav  >  ceil ( $aantal ) )  {       						$nav = 1 ;  
						}  
 
		for  ( $i  =  1 ;  $i  <=  ceil ( $aantal ) ;  $i ++ )  {      							 if  ( $nav  ==  $i )  
        						$navs [ $i ]  =  "<b>$i </b>" ;  
   							 else  
      							  $navs [ $i ]  =  "<a href=\" lezen.php?nav=$i \" >$i </a>" ;  
						}  
 
 
		$vorige  =  ( $nav - 1 )  ? "<a href=\" index.php?pagina=albumlijst&nav="  .  ( $nav  -  1 )  .  "\" >< Vorige</a>"  :  "" ;  
		$volgende  =  ( $nav - ceil ( $aantal ) )  ? 
"<a href=\" index.php?pagina=albumlijst&nav="  .  ( $nav  +  1 )  .  "\" >Volgende ></a>"  :  "" ;    
		if  ( $vorige  &&  $volgende )  {  
    						$navigatie  =  $vorige . " | " . $navs  . " | " . $volgende ;  
						}  
					else  {  
   		 $navigatie  =  $vorige . " | " . $navs . " | " . $volgende ;  
		}  
//Einde Navigatie code 
	} 
 
//Nu gaan we de albums selecteren  
 
//Nu worden alle berichten weergegeven dmv een while  
    //nl2br() zorgt er voor dat er bij elke enter ook een nieuwe lijn komt  
 
?>  
<table class="fotos" width="100%" border="0" cellspacing="0" cellpadding="2"> 
  <tr> 
    <td colspan="2" valign="top"> 
      <strong>naam album </strong>: <span class="style1">
      <?= $obj -> naam ?>  
      </span></td> 
  </tr> 
  <tr> 
    <td width="11%" rowspan="2" valign="top"> 
        <a href="index.php?pagina=album&boek=<?= $obj -> albumurl ?> "><img src="<?= $obj -> albumfotovb ?> " height="100" border="0"></a>
    </td> 
    <td width="89%" height="73" valign="top"><p>
        <?= $obj -> uitleg ?> 
    </a></p>
    <p align="center"> </p></td>
  </tr>
  <tr>
    <td valign="top"><div align="center">>><a href="index.php?pagina=album&boek=<?= $obj -> albumurl ?> " class="style2">bekijk het album</a> </div></td>
  </tr>
  <tr>
    <td colspan="2" valign="top"><hr></td>
  </tr> 
</table> 
<br> 
<?php 
//Deze loop wordt herhaald tot dat alle berichten zijn weergegeven 
} 
?>  
<br> 
<table class="fotos" width="100%" border="1" cellspacing="0" cellpadding="1"> 
  <tr> 
    <td align="center" height="19"><?= $navigatie ?> </td> 
  </tr> 
</table> 
<br>
 
         
     
 
    
    
        
            
                <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 
<?
include ("config.php");
if(is_dir($_GET['boek'])){ 
// configuratie 
$boek = $_GET['boek'];
$originalPath = $boek;                            //de map aangeroepen in de url 
$path = $boek;                        // path naar de foto 
$fotoArray = array(); 
$d = dir("$path");    
while($entry=$d->read()) {    
           if(eregi(".jpg|.jpeg|.gif|.bmp|.png", $entry)){ 
                ClearStatCache();    
       
                 $foto = $path . "/" . $entry ; 
             $fotoArray[] = $foto; 
           
            } 
           
}    
$d->close();    
$count = count($fotoArray); 
$pathspatie = str_replace("_", " ", $originalPath); 
// reactie Plaatsen 
if(isset($_POST["submitreactie"])){ 
    $query = "insert into fotosreacties (boek,foto,naam,datum,reactie) values "; 
    $query .= "('" . $_GET['boek'] . "','" . $fotoArray[$_GET["fotoID"]] . "','" . $_POST["naam"] . "','" . time() . "','" . $_POST["reactie"] . "')"; 
if($result = mysql_query($query)){ 
    echo "Je reactie is geplaatst"; 
    } // end if 
else { 
    echo "Sorry, je reactie kon niet geplaatst worden."; 
    } // end else          
    } // end if 
      
      
      
// kijken hoeveel reacties iedere foto heeft 
$reacties; 
$query = "select foto from fotosreacties where boek = '" . $_GET['boek'] . "'"; 
if($result = mysql_query($query)){ 
    while ($r = mysql_fetch_array($result)){ 
        while ($foto = current($fotoArray)) { 
               if ($foto==$r["foto"]){ 
                   $key = key($fotoArray); 
                   } // end if 
               next($fotoArray); 
            } // end while 
        if(!isset($reacties[$key])){ 
            $reacties[$key] = 1; 
            } // end if      
        else { 
            $reacties[$key]++; 
            } // end else      
            reset($fotoArray); 
        } // end while 
    } // end if      
?> 
<html> 
<head> 
    <title>Fotos</title> 
</head> 
<body> 
<table width="100%"><tr><td align="center" width="100%"> 
<? 
// 1 FOTO PER PAGINA 
if((isset($_GET['fotoID'])) AND (intval($_GET['fotoID']>=0)) AND (intval($_GET['fotoID'] < $count))){ 
    $showFoto = intval($_GET['fotoID']); 
echo "<table width='40%'><tr><td colspan='3' align='center'><b>" . $pathspatie . "</b> 
<br><br><small>Foto " . ($showFoto + 1) . " / " . $count . "</small></big></font> </td></tr><tr>"; 
echo "<tr><td colspan='3'  align='center'><a href='" . $fotoArray[$showFoto] . "'  target='_blanc'><img src='" . $fotoArray[$showFoto] . "' height='300' border='0'></a></td></tr>"; 
echo "<tr><td  width='40%'>"; 
if($showFoto!=0){ 
         $prevFoto = ($showFoto - 1); 
         echo "<a href='" . $_SERVER['PHP_SELF'] . "?pagina=album&boek=" . $originalPath . "&fotoID=" . $prevFoto . "'>vorige</a> "; 
} //  end if 
echo "</td><td  width='33%'>"; 
$pageNR = floor($_GET['fotoID'] / $aantalFotos); 
$pageNR = $pageNR * 18; 
echo "<a href='" . $_SERVER['PHP_SELF'] . "?pagina=album&boek=" . $originalPath . "&vanafFoto=" . $pageNR . "'>lijst</a> "; 
echo "</td><td  align='right'>"; 
if($showFoto!=($count -1)){ 
         $nextFoto = ($showFoto + 1); 
         echo "<a href='" . $_SERVER['PHP_SELF'] . "?pagina=album&boek=" . $originalPath . "&fotoID=" . $nextFoto . "'>volgende</a> "; 
} //  end if 
echo "</td></tr></table>"; 
echo "<br><br><b>Reacties</b>"; 
$reacties; 
$query = "SELECT * FROM fotosreacties where foto = '" . $fotoArray[$showFoto] . "' order by datum ASC"; 
if($result = mysql_query($query)){ 
    if(mysql_numrows($result)==0){ 
        echo "<br><br>Er zijn nog geen reacties"; 
        } // end if 
    else {      
        echo "<table width='40%' cellspacing='0' border='0'  cellpadding='0'>"; 
        echo "<tr><td  colspan='2'><hr></td></tr>"; 
        while ($r = mysql_fetch_array($result)){ 
             echo "<tr><td><b>" . $r["naam"] . "</b> "; 
              echo "</td><td width='40%'><small>[ " . date("d/m/Y @ H:i",$r["datum"]) . " ]</small></td><tr>"; 
             echo "<tr><td  colspan='2'>" . $r["reactie"] . "</td></tr>"; 
              echo "<tr><td  colspan='2'><hr></td></tr>"; 
             } // end while 
        echo "</table>"; 
        } // end else 
    } // end if 
echo "<form method='post' action=''>"; 
echo "<table>"; 
echo "<tr>"; 
echo "<td>Naam:<br><input type='text' name='naam'></td></tr>"; 
echo "<tr><td>Uw Reactie:<br><textarea name='reactie' cols='30' rows='5'></textarea><br></td></tr>"; 
echo "<tr><td><input type='submit' name='submitreactie' value='Verzenden'></td></tr>"; 
echo "</table>";      
echo "</form>"; 
} // end if 
// X FOTOS PER PAGINA 
else { 
// configuratie 
$clm = "3";                                                                      // Aantal kolommen 
$countFotos = count($fotoArray); 
$thumbPath = $path . "/";                                             //Path naar thumps 
$path2 = $path . "/";          
echo "<br><table ><tr>"; 
echo "<td align='center' colspan='" . $clm . "'>"; 
// navigatie 
$navigation; 
if($countFotos < ($aantalFotos + 1)){ 
               $begin = 0; 
               $eind = $countFotos; 
                 
} // end if 
else { 
$aantalPages =  ceil($countFotos / $aantalFotos) ; 
for($i=1; $i < $aantalPages + 1; $i++){ 
          $pageNR = ($i - 1) * $aantalFotos; 
            
          if($pageNR==$_GET["vanafFoto"]){ 
           $navigation .= "<small><font color='#990000'>" . $i . "</font></small> "; 
          } 
            else { 
            $navigation .= "<a href='?pagina=album&boek=" . $originalPath . "&vanafFoto=" . $pageNR . "'>" . $i . "</a> "; 
            } 
} // end for 
if((isset($_GET['vanafFoto'])) AND (intval($_GET['vanafFoto']>=0)) AND (intval($_GET['vanafFoto'] < $countFotos))){ 
        $begin = intval($_GET['vanafFoto']); 
      
       if(($begin + $aantalFotos) <= $countFotos){ 
                     $eind = ($begin + $aantalFotos); 
           } // end if 
      else { 
                   $eind = $countFotos; 
           } // end else 
             
} // end if 
else { 
     $begin = 0; 
     $eind = $aantalFotos; 
} // end else 
                                              
$countFotos = count($fotoArray); 
                                                 // path naar echte foto 
} // end else 
echo "<table border='0' cellpadding='0' cellspacing='2'><tr><td ><b>" . $pathspatie . "</b> <small>(" . $count . ")</small> 
<br><br><center><small>Pictures " . ($begin + 1) . " - " . $eind . "</small></center></td></tr></table>"; 
if(($begin - $aantalFotos) >= 0){ 
             $navigation = "<a href='" . $_SERVER['PHP_SELF'] . "?pagina=album&boek=" . $originalPath . "&vanafFoto=" . ($begin - $aantalFotos) . "'><</a> " . $navigation;              
    } // end if 
              
          
if(($begin + $aantalFotos) < $count){ 
             $navigation .= " <a href='" . $_SERVER['PHP_SELF'] . "?pagina=album&boek=" . $originalPath . "&vanafFoto=" . ($begin + $aantalFotos) . "'>></a>";              
   } // end if 
echo $navigation . "<br><br>"; 
echo "</td></tr><tr>"; 
$fotonr = 1; 
for($i=$begin; $i < $eind; $i++){ 
$thumb = str_replace($path2, $thumbPath, $fotoArray[$i]); 
    echo "<td align='center'><a href='" . $_SERVER['PHP_SELF'] . "?pagina=album&boek=" . $originalPath . "&fotoID=" . $i . "'><img border='0' src='" . $thumb . "' height='100'><br>"; 
echo "<small>reacties ("; 
if($reacties[$i]==0){ 
    echo "0"; 
    } // end if 
else { 
    echo $reacties[$i]; 
    } // end else      
echo ")</small>"; 
echo "</a></td>"; 
    $fotonr++; 
    if($fotonr == ($clm + 1)){ 
    echo "</tr>\n<tr>"; 
     $fotonr = 1; 
} // end if 
      
          
} // end for 
echo "</tr>"; 
echo "<td align='center' colspan='" . $clm . "'>"; 
echo $navigation; 
echo "</td></tr><tr>"; 
echo "</table>";    
} // end else if 
} // end if 
else { 
    echo "Dit fotoalbum bestaat niet"; 
    } // end else 
?> 
</td></tr></table> 
</body> 
</html> 
             
            <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 
<? 
include  ( "config.php" ) ; 
// configuratie  
$boek  =  $_GET [ 'boek' ] ; 
$originalPath  =  $boek ;                             //de map aangeroepen in de url  
$path  =  $boek ;                         // path naar de foto  
 
 
 
while ( $entry = $d -> read ( ) )  {     
           if ( eregi ( ".jpg|.jpeg|.gif|.bmp|.png" ,  $entry ) ) {    
                 $foto  =  $path  .  "/"  .  $entry  ;  
             $fotoArray [ ]  =  $foto ;  
 
            }  
 
}     
 
$d -> close ( ) ;     
$count  =  count ( $fotoArray ) ;   
$pathspatie  =  str_replace ( "_" ,  " " ,  $originalPath ) ;   
 
// reactie Plaatsen  
if ( isset ( $_POST [ "submitreactie" ] ) ) {      $query  =  "insert into fotosreacties (boek,foto,naam,datum,reactie) values " ;  
    $query  .=  "('"  .  $_GET [ 'boek' ]  .  "','"  .  $fotoArray [ $_GET [ "fotoID" ] ]  .  "','"  .  $_POST [ "naam" ]  .  "','"  .  time ( )  .  "','"  .  $_POST [ "reactie" ]  .  "')" ;    
    echo "Je reactie is geplaatst" ;       }  // end if  
else  {  
    echo "Sorry, je reactie kon niet geplaatst worden." ;       }  // end else           
 
    }  // end if  
 
 
 
// kijken hoeveel reacties iedere foto heeft  
$reacties ;  
$query  =  "select foto from fotosreacties where boek = '"  .  $_GET [ 'boek' ]  .  "'" ;  
        while  ( $foto  =  current ( $fotoArray ) )  {                  if  ( $foto == $r [ "foto" ] ) {  
                   }  // end if  
            }  // end while  
        if ( ! isset ( $reacties [ $key ] ) ) {               $reacties [ $key ]  =  1 ;  
            }  // end if       
        else  {  
            $reacties [ $key ] ++;  
            }  // end else       
 
        }  // end while  
    }  // end if       
?>  
 
<html> 
<head> 
    <title>Fotos</title> 
</head> 
 
<body> 
 
 
<table width="100%"><tr><td align="center" width="100%"> 
 
<?  
 
 
// 1 FOTO PER PAGINA  
 
if ( ( isset ( $_GET [ 'fotoID' ] ) )  AND 
( intval ( $_GET [ 'fotoID' ] >= 0 ) )  AND 
( intval ( $_GET [ 'fotoID' ]  <  $count ) ) ) {      $showFoto  =  intval ( $_GET [ 'fotoID' ] ) ;    
echo "<table width='40%'><tr><td colspan='3' align='center'><b>"  .  $pathspatie  .  "</b>  <br><br><small>Foto "  .  ( $showFoto  +  1 )  .  " / "  .  $count  .  "</small></big></font> </td></tr><tr>" ;  
 
echo "<tr><td colspan='3'  align='center'><a href='"  .  $fotoArray [ $showFoto ]  .  "'  target='_blanc'><img src='"  .  $fotoArray [ $showFoto ]  .  "' height='300' border='0'></a></td></tr>" ;  echo "<tr><td  width='40%'>" ;  if ( $showFoto != 0 ) {  
         $prevFoto  =  ( $showFoto  -  1 ) ;  
         echo "<a href='"  .  $_SERVER [ 'PHP_SELF' ]  .  "?pagina=album&boek="  .  $originalPath  .  "&fotoID="  .  $prevFoto  .  "'>vorige</a> " ;   }  //  end if  
echo "</td><td  width='33%'>" ;  $pageNR  =  floor ( $_GET [ 'fotoID' ]  /  $aantalFotos ) ;  $pageNR  =  $pageNR  *  18 ;  
echo "<a href='"  .  $_SERVER [ 'PHP_SELF' ]  .  "?pagina=album&boek="  .  $originalPath  .  "&vanafFoto="  .  $pageNR  .  "'>lijst</a> " ;  echo "</td><td  align='right'>" ;  if ( $showFoto != ( $count  - 1 ) ) {  
         $nextFoto  =  ( $showFoto  +  1 ) ;  
         echo "<a href='"  .  $_SERVER [ 'PHP_SELF' ]  .  "?pagina=album&boek="  .  $originalPath  .  "&fotoID="  .  $nextFoto  .  "'>volgende</a> " ;   }  //  end if  
echo "</td></tr></table>" ;   
 
echo "<br><br><b>Reacties</b>" ;   
$reacties ;  
$query  =  "SELECT * FROM fotosreacties where foto = '"  .  $fotoArray [ $showFoto ]  .  "' order by datum ASC" ;  
        echo "<br><br>Er zijn nog geen reacties" ;           }  // end if  
    else  {       
        echo "<table width='40%' c ellspacing='0' border='0'  cellpadding='0'>" ;           echo "<tr><td  colspan='2'><hr></td></tr>" ;                echo "<tr><td><b>"  .  $r [ "naam" ]  .  "</b> " ;                 echo "</td><td width='40%'><small>[ "  .  date ( "d/m/Y @ H:i" , $r [ "datum" ] )  .  " ]</small></td><tr>" ;                echo "<tr><td  colspan='2'>"  .  $r [ "reactie" ]  .  "</td></tr>" ;                 echo "<tr><td  colspan='2'><hr></td></tr>" ;                }  // end while  
        }  // end else  
    }  // end if  
 
echo "<form method='post' action=''>" ;  echo "<td>Naam:<br><input type='text' name='naam'></td></tr>" ;  echo "<tr><td>Uw Reactie:<br><textarea name='reactie' cols='30' rows='5'></textarea><br></td></tr>" ;  echo "<tr><td><input type='submit' name='submitreactie' value='Verzenden'></td></tr>" ;   
 
 
}  // end if  
 
// X FOTOS PER PAGINA  
 
else  {  
 
// configuratie  
$clm  =  "3" ;                                                                       // Aantal kolommen  
 
 
$countFotos  =  count ( $fotoArray ) ;  $thumbPath  =  $path  .  "/" ;                                              //Path naar thumps  
$path2  =  $path  .  "/" ;           
 
 
 
 
echo "<td align='center' colspan='"  .  $clm  .  "'>" ;   
 
// navigatie  
$navigation ;  
if ( $countFotos  <  ( $aantalFotos  +  1 ) ) {  
               $begin  =  0 ;  
               $eind  =  $countFotos ;  
 
}  // end if  
else  {  
 
$aantalPages  =   ceil ( $countFotos  /  $aantalFotos )  ;  for ( $i = 1 ;  $i  <  $aantalPages  +  1 ;  $i ++ ) {  
          $pageNR  =  ( $i  -  1 )  *  $aantalFotos ;  
 
          if ( $pageNR == $_GET [ "vanafFoto" ] ) {  
           $navigation  .=  "<small><font color='#990000'>"  .  $i  .  "</font></small> " ;  
          }  
            else  {  
            $navigation  .=  "<a href='?pagina=album&boek="  .  $originalPath  .  "&vanafFoto="  .  $pageNR  .  "'>"  .  $i  .  "</a> " ;  
            }  
}  // end for  
 
 
if ( ( isset ( $_GET [ 'vanafFoto' ] ) )  AND 
( intval ( $_GET [ 'vanafFoto' ] >= 0 ) )  AND 
( intval ( $_GET [ 'vanafFoto' ]  <  $countFotos ) ) ) {          $begin  =  intval ( $_GET [ 'vanafFoto' ] ) ;    
       if ( ( $begin  +  $aantalFotos )  <=  $countFotos ) {  
                     $eind  =  ( $begin  +  $aantalFotos ) ;  
           }  // end if  
      else  {  
                   $eind  =  $countFotos ;  
           }  // end else  
 
}  // end if  
else  {  
     $begin  =  0 ;  
     $eind  =  $aantalFotos ;  
}  // end else  
 
$countFotos  =  count ( $fotoArray ) ;   
 
                                                 // path naar echte foto  
 
}  // end else  
 
echo "<table border='0' cellpadding='0' cellspacing='2'><tr><td ><b>"  .  $pathspatie  .  "</b> <small>("  .  $count  .  ")</small>  <br><br><center><small>Pictures "  .  ( $begin  +  1 )  .  " - "  .  $eind  .  "</small></center></td></tr></table>" ;  
 
 
 
if ( ( $begin  -  $aantalFotos )  >=  0 ) {  
             $navigation  =  "<a href='"  .  $_SERVER [ 'PHP_SELF' ]  .  "?pagina=album&boek="  .  $originalPath  .  "&vanafFoto="  .  ( $begin  -  $aantalFotos )  .  "'><</a> "  .  $navigation ;               
    }  // end if  
 
 
if ( ( $begin  +  $aantalFotos )  <  $count ) {  
             $navigation  .=  " <a href='"  .  $_SERVER [ 'PHP_SELF' ]  .  "?pagina=album&boek="  .  $originalPath  .  "&vanafFoto="  .  ( $begin  +  $aantalFotos )  .  "'>></a>" ;               
   }  // end if  
 
echo $navigation  .  "<br><br>" ;  $fotonr  =  1 ;  
for ( $i = $begin ;  $i  <  $eind ;  $i ++ ) {  
 
 
$thumb  =  str_replace ( $path2 ,  $thumbPath ,  $fotoArray [ $i ] ) ;   
 
    echo "<td align='center'><a href='"  .  $_SERVER [ 'PHP_SELF' ]  .  "?pagina=album&boek="  .  $originalPath  .  "&fotoID="  .  $i  .  "'><img border='0' src='"  .  $thumb  .  "' height='100'><br>" ;   echo "<small>reacties (" ;  if ( $reacties [ $i ] == 0 ) {  
    }  // end if  
else  {  
    }  // end else       
    $fotonr ++;  
    if ( $fotonr  ==  ( $clm  +  1 ) ) {  
     $fotonr  =  1 ;  
}  // end if  
 
 
 
 
}  // end for  
 
echo "<td align='center' colspan='"  .  $clm  .  "'>" ;   
 
 
 
}  // end else if  
}  // end if  
else  {  
    echo "Dit fotoalbum bestaat niet" ;       }  // end else  
?>  
</td></tr></table> 
 
</body> 
</html>
 
         
     
 Download code (.txt) 
                     
                     
                
                
            
            
                    
 
            
                
                Stemmen  
                
                Niet ingelogd.