Sorry I didn't ask in the other thread, but to keep other from getting confused when reading I feel it's better to keep seperate questions apart.. plus this one came to me after I marked that other on resolved.
I have a page here.
http://www.svcsports.com/port/modules/photos.php
The grabs images from a directory as thumbnails, then when you click it, it will take you to the larger version (Already programmed to "know" the next page it should go to)
Here's the code for that photo.php
<html>
<head>
<title>
Modules
</title>
</head>
<body>
<style stype='text/css'>
body {
background-color: #D8D7D5;
background-image: url(../bg.gif);
background-position: top;
background-repeat: repeat-x;
color: #ffffff;
font-family: Verdana, Tahoma, Arial, Trebuchet MS, Sans-Serif, Georgia, Courier, Times New Roman, Serif;
font-size: 10px;
margin: 0;
padding: 0; }
</style>
<!-- ImageReady Slices (Untitled-1) -->
<table id="Table_01" width="500" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="about.php" target="_self">
<img src="../About.gif" width="68" height="29" border="0" alt="About Me!"></a></td>
<td>
<a href="modules.php" target="_self">
<img src="../about_02.gif" width="94" height="29" border="0" alt="My Modules"></a></td>
<td rowspan="2">
<img src="../about_03.gif" width="338" height="100" alt=""></td>
</tr>
<tr>
<td colspan="2">
<img src="../about_04.gif" width="162" height="71" alt=""></td>
</tr>
</table>
<br>
<br>
<br>
<div align='center'>
<table width='705px'>
<tr>
<td valign='top' height='500px' background='../table_top_bg2.gif'>
<table width='680px'>
<tr>
<td>
<font size='2'> <b><a href='../index.php'><font color='white'>Home</font></a></b> - <b><a href='../modules.php'><font color='white'>Modules</font></a></b> - <b>
<a href='../modules/photos.php'><font color='white'>Photos</font></a></b><br><br>
<center>
<div align="center"><center> Please click on a thumbnail to the see the full size.
<?php
$a = '0';
$filepath = "../modules/thumbs/";
$url_path = "../modules/fullsize/";
$dir = dir($filepath);
echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"5\" width=\"75%\">";
while($entry=$dir->read()) {
if($entry == "." || $entry == "..") {
continue;
}
$fp = @fopen("$filepath/$entry","r");
if ($a == '0') {echo "<tr>";}
if ($a == '5') {echo "<tr>";}
if ($a == '10') {echo "<tr>";}
if ($a == '15') {echo "<tr>";}
?><td>
<a href="<? echo "$url_path$entry.php" ?>">
<img src="<? echo "$filepath$entry" ?>" alt="<? echo $entry ?>" border='0'></a>
</td>
<?
$a = $a + 1;
}
?>
</tr>
</table>
</center></div>
</center>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div align='center><font size='1' color='navy'>Copyright © 2001-2004 AndrewWest Scripts</font></div>
<!-- End ImageReady Slices -->
</body>
</html>
And here's an example of the page it would go to..
<?php
$path = $_SERVER['PHP_SELF'];
$path_parts = pathinfo($path);
$string = $path_parts["basename"];
$exclude = ".jpg.php";
$path = substr("$string",0,strpos($string,$exclude));
if(isset($_POST['submit'])) {
$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$link = mysql_connect('localhost', 'HIDDEN', 'HIDDEN');
$db_selected = mysql_select_db('andrew_site', $link);
$query = "SELECT last_ip FROM photographys WHERE name=$path";
$result = mysql_query($query);
$extip = mysql_result($result,0);
if ($extip == $ip) {
header("Location: error.php");
}
$message = stripslashes(trim($message));
$message = nl2br($message);
$message = htmlentities($message);
$query = "INSERT INTO photos (ip, comment, photo)
VALUES ('$ip', '$message', '$path')";
mysql_query($query);
mysql_close();
echo "Thanks $name your comment has been added";
}
?>
<html>
<head>
<title>
Modules
</title>
</head>
<body>
<style stype='text/css'>
body {
background-color: #D8D7D5;
background-image: url(../.././bg.gif);
background-position: top;
background-repeat: repeat-x;
color: #ffffff;
font-family: Verdana, Tahoma, Arial, Trebuchet MS, Sans-Serif, Georgia, Courier, Times New Roman, Serif;
font-size: 10px;
margin: 0;
padding: 0; }
</style>
<!-- ImageReady Slices (Untitled-1) -->
<table id="Table_01" width="500" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="about.php" target="_self">
<img src="../.././About.gif" width="68" height="29" border="0" alt="About Me!"></a></td>
<td>
<a href="modules.php" target="_self">
<img src="../.././about_02.gif" width="94" height="29" border="0" alt="My Modules"></a></td>
<td rowspan="2">
<img src="../.././about_03.gif" width="338" height="100" alt=""></td>
</tr>
<tr>
<td colspan="2">
<img src="../.././about_04.gif" width="162" height="71" alt=""></td>
</tr>
</table>
<br>
<br>
<br>
<div align='center'>
<table width='705px'>
<tr>
<td valign='top' height='500px' background='../.././table_top_bg2.gif'>
<table width='680px'>
<tr>
<td>
<font size='2'> <b><a href='../../index.php'><font color='white'>Home</font></a></b> - <b><a href='../../modules.php'><font color='white'>Modules</font></a></b> - <b>
<a href='../../modules/photos.php'><font color='white'>Photos</font></a></b><br><br>
<center>
<div align="center"><center>
<br><br>
<?php
$path = $_SERVER['PHP_SELF'];
$path_parts = pathinfo($path);
$string = $path_parts["basename"];
$exclude = ".php";
$path = substr("$string",0,strpos($string,$exclude));
echo "<img src='$path'>";
?>
<form name="guestbook" method="post" action="<?php echo $PHP_SELF ?>">
<table align="center" cellpadding="6" cellspacing="0">
<tr>
<td><font size='2' color='white'>Add A Comment!</font></td>
</tr>
</tr>
<tr>
<td><textarea name="message" cols="60" rows="3"></textarea></td>
</tr>
<tr>
<td align='center'><input type="submit" name="submit" value="Add" style="cursor:pointer"> <input type="reset" name="reset" value="Clear" style="cursor:pointer"></td>
</tr>
</table>
</form>
<hr>
<br>
<div align='center>'><font size='2' color='white'>Comments made to this photo</font></div>
<br>
<?php
$link = mysql_connect('localhost', 'HIDDEN', 'HIDDEN');
if (!$link) {
die('Not connected : ' . mysql_error());
}
mysql_select_db('andrew_site', $link);
$path = $_SERVER['PHP_SELF'];
$path_parts = pathinfo($path);
$string = $path_parts["basename"];
$exclude = "jpg.php";
$path = substr("$string",0,strpos($string,$exclude));
$query = "SELECT comment FROM photos WHERE photo=$path order by id DESC";
$result = mysql_query($query);
echo "<br><table align='center' width='75%' cellpadding='4' cellspacing='1' bgcolor='#D8D7D5'>";
while($r=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td background='../../table_top_bg2.gif'><font size='2'>$r[comment]</font></td>";
echo "</tr>";
echo "<tr><td background='../../table_top_bg2.gif'> </td></tr>";
}
echo "</table>";
?>
</center></div>
</center>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- End ImageReady Slices -->
</body>
</html>