NEXT page won't work. I've sat starring at this for hours. I can't figure out why "Next Page" won't work, can someone help please.
here it is..
<?
// Popup Graemlin Panel
//
// Copyright David Lozier 2003. All Rights reserved.
//
// This software may be used and modified freely provided that
// the copyright notice remains intact at the head of the file.
//
// This software may NOT be distributed without expressed written
// consent from the author.
//
// The author accepts no liability for any loss or damages whatsoever
// incurred directly or indirectly from the use of this software.
// The author of this software makes no claims as to its fitness for
// any purpose whatsoever. If you wish to use this software you
// should first satisfy yourself that it meets your requirements.
//
// Email: []
[email protected][/]
// URL:
http://www.chattersonline.com // configure your database settings
$host = "localhost"; // Server Name
$user= "edited-out"; // Username
$password= "edited-out"; // Password
$database="the_jersey_devil"; // Photopost database name or forum database name
// Connecting, selecting database
$link = mysql_connect ("$host", "$user", "$password") or die ("I cannot connect to the database.");
require ("main.inc.php");
$pp_prefix="photopost_";
$data_dir ="http://www.the-jersey-devil.com/photopost/data"; //URL of your photo dir where those jpeg stored (with no / at end)
function get_ext( $filename ) {
return substr($filename, strrpos($filename,"."));
}
function is_image( $filename ) {
$retval = 0;
$mediatypes = array( ".jpg", ".gif", ".png" );
$ext = get_ext( $filename );
if ( in_array(strtolower($ext), $mediatypes) )
$retval = 1;
return( $retval );
}
$userob = new user;
$user = $userob -> authenticate();
$StyleSheet= $user['U_StyleSheet'];
$Status = $user['U_Status'];
$ubbt_language = ${$config['cookieprefix']."w3t_language"};
if (empty($ubbt_language)) { $ubbt_language = $config['language']; }
require ("$thispath/languages/$ubbt_language/instant_markup.php");
if (empty($StyleSheet) || ($StyleSheet == "usedefault") ) {
$StyleSheet = $theme['stylesheet'];
}
$theme['css_wrapper'] = $StyleSheet;
$myLang = "<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />";
$styleLink = "<link rel="stylesheet" href="{$config['styledir']}/$StyleSheet.css" type="text/css" />";
$html = new html;
list($tbopen,$tbclose) = $html -> table_wrapper();
if ( !isset($page) || $page == 0 ) {
$page = 0;
$nextpage = 1;
$prevpage = -1;
}
else {
$nextpage = $page + 1;
if ( $page > 1 ) $prevpage = $page - 1;
else $prevpage = 0;
$page = ($page*16);
}
mysql_select_db ("the_jersey_devil")or die("Could not select database"); //name of the photopostdb here
$query = "SELECT id,cat,title,bigimage,medsize FROM {$pp_prefix}photos WHERE userid = {$user['U_Number']} ORDER BY date DESC LIMIT $page,16";
$result = mysql_query($query);
$sth = $dbh -> do_query($query);
$numrows = $dbh -> total_rows($sth);
if ( $numrows < 16 ) $nextpage = 0;
$i=0;
$color = "lighttable";
$photorow="";
$photopanel="";
mysql_select_db ("the_jersey_devil")or die("Could not select database"); //name of the ubbthreadsdb here
while (list($ppid, $ppcat, $pptitle, $photo, $medsize) = $dbh -> fetch_array($sth)) {
if ( is_image($photo) ) {
$photolen = strlen($photo);
$theext = get_ext($photo);
$photo_name = str_replace( $theext, "", $photo );
if ( $medsize > 0 ) $imgurl = "[img]{$data_dir}/$ppcat/{$user['U_Number']}{$photo_name}-med{$theext}[/img]";
else $imgurl = "[img]{$data_dir}/$ppcat/{$user['U_Number']}$photo[/img]";
$mthumb = "<img border="0" src="{$data_dir}/{$ppcat}/{$user['U_Number']}{$photo_name}-thumb{$theext}" alt="" />";
$photorow .= <<<EOF
<td width="25%" align="center" valign="middle" class="$color">
<a href="javascript:void(0)" onclick="updatePost(' $imgurl')">$mthumb</a>
</td>
EOF;
$i++;
if ($i==4) {
$i=0;
$photopanel .= "<tr>$photorow</tr>";
$photorow = "";
$color = $html -> switch_colors($color);
}
}
}
if (!empty($photorow)) {
$photopanel .= "<tr>$photorow";
}
if ($numrows == 0 && $page == 0) {
$photopanel .= <<<EOF
<td colspan="4" align="center" valign="middle" class="$color">You have no images in your PhotoPost gallery.</td>
</tr>
EOF;
}
elseif ($i==1) {
$photopanel .= <<<EOF
<td width="25%" align="center" valign="middle" class="$color">
</td>
<td width="25%" align="center" valign="middle" class="$color">
</td>
<td width="25%" align="center" valign="middle" class="$color">
</td>
</tr>
EOF;
}
elseif ($i==2) {
$photopanel .= <<<EOF
<td width="25%" align="center" valign="middle" class="$color">
</td>
<td width="25%" align="center" valign="middle" class="$color">
</td>
</tr>
EOF;
}
elseif ($i==3) {
$photopanel .= <<<EOF
<td width="25%" align="center" valign="middle" class="$color">
</td>
</tr>
EOF;
}
echo <<<UBBTPRINT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>PhotoPost Panel</title>
$myLang
$styleLink
<script language="JavaScript" type="text/JavaScript">
function updatePost(GraemlinCode) {
BodyVal = opener.document.replier.Body.value;
opener.document.replier.Body.value = BodyVal + GraemlinCode;
}
</script>
</head>
<body>
$tbopen
<tr>
<td align="left" colspan="4" class="tdheader">
Instant PhotoPost
</td>
</tr>
$photopanel
</tr>
<tr>
<td colspan="2" class="lighttable">
UBBTPRINT;
if ( $prevpage != -1 ) echo "<< <a href="pppanel.php?page=$prevpage">PREV PAGE</a>";
echo <<<UBBTPRINT
</td>
<td colspan="2" class="lighttable" align="right">
UBBTPRINT;
if ( $nextpage > 0 ) echo "<a href="pppanel.php?page=$nextpage">NEXT PAGE</a> >>";
echo <<<UBBTPRINT
</td>
</tr>
<tr>
<td colspan="4" class="lighttable" align="center">
<a href="#" onclick="javascript:window.close();">close window</a>
</td>
</tr>
$tbclose
</body>
</html>
UBBTPRINT;
?>