Vorige volgende foto gallery
Ik heb een fotogallery script (niet zelf gemaakt maar goed) het werkt prima alleen heb ik bij de vergroting geen vorige/volgende link erin zitten wat best wel irritant is. Iedere keer terug enzo..
Nou vroeg ik mij af of jullie weten hoe ik dit makkelijk in mijn script kan invoeren.
hier is het script:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<br>
<table width="90%" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid" cellspacing="0" cellpadding="0" align="center" valign="bottom">
<tr><td colspan="2" bgcolor="#CCCCCC"><center><b><a href=""></a>
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<?php
if($_GET['catid']) {
$query = mysql_query("SELECT naam FROM fotoboek_categories WHERE id='" . $_GET['catid'] . "'") or die(mysql_error());
$naam = mysql_result($query,0,"naam");
echo " > <a href=\"" . $PHP_SELF . "?action=bekijk_cat&id=" . $_GET['catid'] . "\">" . stripslashes($naam) . "</a>";
}
?>
if($_GET['catid']) {
$query = mysql_query("SELECT naam FROM fotoboek_categories WHERE id='" . $_GET['catid'] . "'") or die(mysql_error());
$naam = mysql_result($query,0,"naam");
echo " > <a href=\"" . $PHP_SELF . "?action=bekijk_cat&id=" . $_GET['catid'] . "\">" . stripslashes($naam) . "</a>";
}
?>
</b></center></td></tr>
<tr bgcolor="#E4E4E4"><td>
<center>
<br>
<table style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid" width="100%" align="center">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$query = mysql_query("SELECT * FROM fotoboek_afbeeldingen WHERE id='" . $_GET['id'] . "'") or die(mysql_error());
while($var = mysql_fetch_object($query)) {
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
echo "<tr><td bgcolor=\"#CCCCCC\" colspan=\"3\"><center><b>" . stripslashes($var->titel) . "</b></center></td></tr>\n";
echo "</table></td></tr></table><br>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
echo "<tr><td colspan=\"2\" bgcolor=\"#E4E4E4\"><br><center><img style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" src=\"" . $fotoboek_url . $var->afbeelding . "\"></center><br></td></tr>\n";
echo "<tr><td colspan=\"2\" bgcolor=\"#E4E4E4\" align=\"center\">" . stripslashes($var->beschrijving) . "</td></tr>\n";
/* echo "<tr><td colspan=\"2\" bgcolor=\"#E4E4E4\" align=\"center\">" Vorige Volgende"</td></tr>\n"; */
echo "</table></td></tr></table><br>";
}
?>
$query = mysql_query("SELECT * FROM fotoboek_afbeeldingen WHERE id='" . $_GET['id'] . "'") or die(mysql_error());
while($var = mysql_fetch_object($query)) {
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
echo "<tr><td bgcolor=\"#CCCCCC\" colspan=\"3\"><center><b>" . stripslashes($var->titel) . "</b></center></td></tr>\n";
echo "</table></td></tr></table><br>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
echo "<tr><td colspan=\"2\" bgcolor=\"#E4E4E4\"><br><center><img style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" src=\"" . $fotoboek_url . $var->afbeelding . "\"></center><br></td></tr>\n";
echo "<tr><td colspan=\"2\" bgcolor=\"#E4E4E4\" align=\"center\">" . stripslashes($var->beschrijving) . "</td></tr>\n";
/* echo "<tr><td colspan=\"2\" bgcolor=\"#E4E4E4\" align=\"center\">" Vorige Volgende"</td></tr>\n"; */
echo "</table></td></tr></table><br>";
}
?>
<br>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
if($commentaar_posten) {
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
echo "<tr><td bgcolor=\"#CCCCCC\" colspan=\"3\"><center><b>Reacties</b></center></td></tr>\n";
echo "</table></td></tr></table><br>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
$query = mysql_query("SELECT * FROM fotoboek_commentaar WHERE foto_id='" . $_GET['id'] . "'") or die(mysql_error());
if(mysql_num_rows($query) > 0) {
while($var = mysql_fetch_object($query)) {
echo "<tr><td bgcolor=\"#CCCCCC\" vAlign=\"top\" align=\"left\" width=\"10%\"><b><a href=\"mailto:" . $var->email . "\">" . stripslashes($var->auteur) . "</a></b> </td><td bgcolor=\"#E4E4E4\">" . stripslashes($var->commentaar) . "</td></tr>\n";
}
} else {
echo "<tr><td bgcolor=\"#E4E4E4\" colspan=\"3\"><center><b>Er zijn nog geen reacties gepost!</b></center></td></tr>\n";
}
echo "<tr><td bgcolor=\"#CCCCCC\" colspan=\"3\"><p align=\"right\">Ga naar <a href=\"javascript:var w = window.open('fotoboek_reacties.php?action=post_reactie&id=" . $_GET['id'] . "','Reactie','resizable=yes,scrollbars=yes,width=510,height=380,top=100,left=150');w.focus()\">deze pagina</a> om een reactie toe te voegen!</a></p></td></tr>\n";
echo "</table></td></tr></table><br>";
}
?>
if($commentaar_posten) {
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
echo "<tr><td bgcolor=\"#CCCCCC\" colspan=\"3\"><center><b>Reacties</b></center></td></tr>\n";
echo "</table></td></tr></table><br>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\">";
echo "<tr bgcolor=#000000\"><td bgcolor=\"#000000\">\n";
echo "<table style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" width=\"100%\">\n";
$query = mysql_query("SELECT * FROM fotoboek_commentaar WHERE foto_id='" . $_GET['id'] . "'") or die(mysql_error());
if(mysql_num_rows($query) > 0) {
while($var = mysql_fetch_object($query)) {
echo "<tr><td bgcolor=\"#CCCCCC\" vAlign=\"top\" align=\"left\" width=\"10%\"><b><a href=\"mailto:" . $var->email . "\">" . stripslashes($var->auteur) . "</a></b> </td><td bgcolor=\"#E4E4E4\">" . stripslashes($var->commentaar) . "</td></tr>\n";
}
} else {
echo "<tr><td bgcolor=\"#E4E4E4\" colspan=\"3\"><center><b>Er zijn nog geen reacties gepost!</b></center></td></tr>\n";
}
echo "<tr><td bgcolor=\"#CCCCCC\" colspan=\"3\"><p align=\"right\">Ga naar <a href=\"javascript:var w = window.open('fotoboek_reacties.php?action=post_reactie&id=" . $_GET['id'] . "','Reactie','resizable=yes,scrollbars=yes,width=510,height=380,top=100,left=150');w.focus()\">deze pagina</a> om een reactie toe te voegen!</a></p></td></tr>\n";
echo "</table></td></tr></table><br>";
}
?>
<br>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?
} elseif($_GET['action'] == "bekijk_cat") {
$sql_query = ("SELECT id,thumbnail,titel FROM fotoboek_afbeeldingen WHERE categorie='" . $_GET['id'] . "' ORDER BY id ASC");
if(!$_GET['pagina']) {
$page = 1;
} else {
$page = $_GET['pagina'];
}
$prev_page = $page - 1;
$next_page = $page + 1;
$query = @mysql_query($sql_query) or die(mysql_error());
$page_start = ($per_pagina * $page) - $per_pagina;
$num_rows = @mysql_num_rows($query);
if($num_rows <= $per_pagina) {
$num_pages = 1;
}
else if (($num_rows % $per_pagina) == 0) {
$num_pages = ($num_rows / $per_pagina);
} else {
$num_pages = ($num_rows / $per_pagina) + 1;
}
$num_pages = (int) $num_pages;
if (($page > $num_pages) || ($page < 0)) {
echo "<font color=red><h1>E R R O R</h1><p><b>Verkeerd pagina nummer</b></font>";
}
$sql_query = $sql_query . " LIMIT
$page_start, $per_pagina";
if ($prev_page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$prev_page\">«</a> ";
}
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$i\">$i</a> ";
} else {
echo "$i ";
}
}
if ($page != $num_pages) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$next_page\">»</a>" ;
}
?>
} elseif($_GET['action'] == "bekijk_cat") {
$sql_query = ("SELECT id,thumbnail,titel FROM fotoboek_afbeeldingen WHERE categorie='" . $_GET['id'] . "' ORDER BY id ASC");
if(!$_GET['pagina']) {
$page = 1;
} else {
$page = $_GET['pagina'];
}
$prev_page = $page - 1;
$next_page = $page + 1;
$query = @mysql_query($sql_query) or die(mysql_error());
$page_start = ($per_pagina * $page) - $per_pagina;
$num_rows = @mysql_num_rows($query);
if($num_rows <= $per_pagina) {
$num_pages = 1;
}
else if (($num_rows % $per_pagina) == 0) {
$num_pages = ($num_rows / $per_pagina);
} else {
$num_pages = ($num_rows / $per_pagina) + 1;
}
$num_pages = (int) $num_pages;
if (($page > $num_pages) || ($page < 0)) {
echo "<font color=red><h1>E R R O R</h1><p><b>Verkeerd pagina nummer</b></font>";
}
$sql_query = $sql_query . " LIMIT
$page_start, $per_pagina";
if ($prev_page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$prev_page\">«</a> ";
}
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$i\">$i</a> ";
} else {
echo "$i ";
}
}
if ($page != $num_pages) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$next_page\">»</a>" ;
}
?>
<br><br>
<table border="1" bordercolor="#000000" align="center" width=80%>
<tr align="center" valign="bottom">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$query = mysql_query($sql_query) or die(mysql_error());
$aantal = mysql_num_rows($query);
$i = 0;
while($var = mysql_fetch_object($query)) {
if($i == $aantal_kolommen) { $i = 0; echo "</tr><tr align=\"center\" valign=\"bottom\">"; }
$commentq = mysql_query("SELECT * FROM fotoboek_commentaar WHERE foto_id='" . $var->id . "'") or die(mysql_error());
$aantal_comments = mysql_num_rows($commentq);
echo "<td><table border=0><tr><td vAlign=top>";
echo "<center><a href=\"" . $PHP_SELF . "?action=bekijk_foto&catid=" . $_GET['id'] . "&id=" . $var->id . "\"><img style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" src=\"" . $fotoboek_url . $var->thumbnail . "\" alt=\"" . $var->titel . "\"></a></center></td></tr>";
echo "<tr><td vAlign=middle><center><a href=\"" . $PHP_SELF . "?action=bekijk_foto&catid=" . $_GET['id'] . "&id=" . $var->id . "\">" . $var->titel . "</a></center></td></tr></table></td>\n";
$i++;
}
if($i < $aantal_kolommen) { $colspan = $aantal_kolommen - $i; echo "<td colspan=\"" . $colspan . "\"> </td>"; }
?>
$query = mysql_query($sql_query) or die(mysql_error());
$aantal = mysql_num_rows($query);
$i = 0;
while($var = mysql_fetch_object($query)) {
if($i == $aantal_kolommen) { $i = 0; echo "</tr><tr align=\"center\" valign=\"bottom\">"; }
$commentq = mysql_query("SELECT * FROM fotoboek_commentaar WHERE foto_id='" . $var->id . "'") or die(mysql_error());
$aantal_comments = mysql_num_rows($commentq);
echo "<td><table border=0><tr><td vAlign=top>";
echo "<center><a href=\"" . $PHP_SELF . "?action=bekijk_foto&catid=" . $_GET['id'] . "&id=" . $var->id . "\"><img style=\"BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid\" src=\"" . $fotoboek_url . $var->thumbnail . "\" alt=\"" . $var->titel . "\"></a></center></td></tr>";
echo "<tr><td vAlign=middle><center><a href=\"" . $PHP_SELF . "?action=bekijk_foto&catid=" . $_GET['id'] . "&id=" . $var->id . "\">" . $var->titel . "</a></center></td></tr></table></td>\n";
$i++;
}
if($i < $aantal_kolommen) { $colspan = $aantal_kolommen - $i; echo "<td colspan=\"" . $colspan . "\"> </td>"; }
?>
</tr>
</table><br>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?
if ($prev_page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$prev_page\">«</a> ";
}
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$i\">$i</a> ";
} else {
echo "$i ";
}
}
if ($page != $num_pages) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$next_page\">»</a>" ;
}
} else {
?>
if ($prev_page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$prev_page\">«</a> ";
}
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $page) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$i\">$i</a> ";
} else {
echo "$i ";
}
}
if ($page != $num_pages) {
echo "<a href=\"$PHP_SELF?action=bekijk_cat&id=" . $_GET['id'] . "&pagina=$next_page\">»</a>" ;
}
} else {
?>
<table border="0" width="100%">
Code (php)
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
<?php
$query = mysql_query("SELECT * FROM fotoboek_categories ORDER BY id ASC") or die(mysql_error());
while($var = mysql_fetch_object($query)) {
$catq = mysql_query("SELECT id FROM fotoboek_afbeeldingen WHERE categorie='" . $var->id . "'") or die(mysql_error());
echo "<tr><td width=\"35%\"><a href=\"" . $PHP_SELF . "?action=bekijk_cat&id=" . $var->id . "\">" . stripslashes($var->naam) . "</a></td><td width=\"40%\"><left>" . stripslashes($var->uitleg) . "</center></td><td><center>" . mysql_num_rows($catq) . " foto's.</center></td></tr>\n";
}
?>
$query = mysql_query("SELECT * FROM fotoboek_categories ORDER BY id ASC") or die(mysql_error());
while($var = mysql_fetch_object($query)) {
$catq = mysql_query("SELECT id FROM fotoboek_afbeeldingen WHERE categorie='" . $var->id . "'") or die(mysql_error());
echo "<tr><td width=\"35%\"><a href=\"" . $PHP_SELF . "?action=bekijk_cat&id=" . $var->id . "\">" . stripslashes($var->naam) . "</a></td><td width=\"40%\"><left>" . stripslashes($var->uitleg) . "</center></td><td><center>" . mysql_num_rows($catq) . " foto's.</center></td></tr>\n";
}
?>
</table>
</center>
</td></tr>
</table>
</BODY>
</HTML>
Er zijn nog geen reacties op dit bericht.