profile.php would have:
<?
$n = $_SESSION['sess_name'];
$rr = rtrim($user[0]);
$rt = rtrim($n);
?>
<?
//########################################IMAGES in GALLERY####################################################
//Get each image in the users gallery
$offset = isset($_REQUIRE['offset'])?$_REQUIRE['offset']:0;
if(!$offset || $offsett<0) $offset=0;
$recent = 0;
while( $rows = mysql_fetch_row($res) ){
if( $recent >= $offset && $recent < ($offset + 10 )){
if( $recent%2 == 0 ){
echo "<tr><td><tr><td><tr><td><tr><td><tr>";
}
//Display each image in gallery
echo "<td width=16%><center><a href='trances.php?id=$rows[0]&l=$log'><img src=thumbnail.php?img=$rows[3] border=0></a>";
echo "<br><b><a href='trances.php?id=$rows[0]&l=$log'>$rows[1]</a></b><br> $rows[5]";
//If this is the current users gallery with proper level or an admin allow edit
if( $gall==$rows[2] && $rr == $rt && $user[2] > 0 || $lev > 7) {
echo "<br><a href='imageedit.php?id=$rows[0]'>Edit image.</a>";
}
//If this is the current users gallery or an admin allow delete
if( $rr == $rt || $lev > 7){
echo "<br><a href='deleteimage.php?id=$rows[0]'>Delete image.</a><br>";
}
echo "</center>";
}
$recent = $recent + 1;
}
//########################################IMAGES in GALLERY####################################################
?>
Where the rows are called from in an earlier section of profile.php:
/* figure out what gallery is this */
$g = isset($_REQUEST['g'])?$_REQUEST['g']:false;
if($g){
$gall = $g;
}else{
$gall=$_SESSION['gal'];
}
$lev=isset($_SESSION['level2'])?$_SESSION['level2']:0;
/* Intercept form vars */
$submit = isset($_REQUEST['submit'])?$_REQUEST['submit']:false;
$sub = isset($_REQUEST['sub'])?$_REQUEST['sub']:'';
$name = isset($_REQUEST['name'])?$_REQUEST['name']:'';
$bod = isset($_REQUEST['bod'])?$_REQUEST['bod']:'';
$send = isset($_REQUEST['send'])?$_REQUEST['send']:0;
if($submit){
$s = $sub." by ".$name;
//$b= emote($bod);
mysql_query("INSERT INTO artistcomment (userID,subject,content,date,sender) VALUES ( '$g', '$s', '$bod', NOW(),$send )")or die ( mysql_error());
mysql_query("INSERT INTO messagedata (recBoxID, sendBoxID, content, subject, isNew, date) VALUES ($gall, '7', 'Profile Comment Recieved <br><a href=profile.php?g=$gall>Please click here to go to your profile</a>.<br>This is automated message please do not reply.', 'New Profile comment received!', 1, NOW() )");
}
//get the users information
$res = mysql_query("SELECT login, views, level, rName, age, gender, aim, yahoo, msn, icq, livejournal, bio,email, country, website,mood, status, icon, webcam, arttype FROM userdata WHERE id='$gall'");
$user = mysql_fetch_row($res);
mysql_free_result($res);
$res = mysql_query("SELECT COUNT(*) FROM userdata WHERE imageFavs='$gall'");
$numFavs = mysql_fetch_row($res);
mysql_free_result($res);
$res = mysql_query("SELECT COUNT(*) FROM artistcomment WHERE userID='$gall'");
$numCom = mysql_fetch_row($res);
mysql_free_result($res);
$res = mysql_query("SELECT COUNT(*) FROM image WHERE gallNum='$gall'");
$numImage = mysql_fetch_row($res);
mysql_free_result($res);
$res = mysql_query("SELECT id, name, gallNum, URL, description, addDate FROM image WHERE gallNum='$gall' ORDER BY id DESC");
$log = $user[0];