can somebody plz help me in gallery comments. i m getting error in gallery comments if any user tries to delete his comments on gallery then they cant delete the comments given by other users in gallery.here it is the codings below.i m getting error like "I don't know how did you get into here but there's nothing to show" plz tell me. thanks
---------------------------------------------------------------------------------------
else if($action=="comments")
{
$who = $_GET["who"];
$gid = $_GET["gid"];
addonline(getuid_sid($sid),"Viewing Photo Comments","");
echo "<card id=\"main\" title=\"GALLERY\">";
$uid = getuid_sid($sid);
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_galcomments WHERE pid='".$gid."'"));
$num_items = $noi[0]; //changable
$items_per_page= 5;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$sql = "SELECT id, pid, text, byuser, time FROM fun_galcomments WHERE pid='".$gid."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if(isonline($item[3]))
{
$iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
}
$snick = getnick_uid($item[3]);
$lnk = "<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$iml$snick</a>:";
$bs = date("d m y-H:i:s",$item[4]);
echo "$lnk
";
$me = getuid_sid($sid);
if($who=="$me") {
$can = "a";
}else{
$can = "b";
}
if(ismod($uid)||$can=="a")
{
$delnk = "<a href=\"modproc.php?action=delcmt&sid=$sid&id=$item[0]\">[x]</a>";
}else{
$delnk = "";
}
$text = parsepm($item[2], $sid);
echo "$text $delnk
";
echo "$bs";
echo "
";
echo "";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"gallery.php?action=$action&page=$ppage&sid= $sid&who=$who&gid=$gid\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"gallery.php?action=$action&page=$npage&sid= $sid&who=$who&gid=$gid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"gallery.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
$me = getuid_sid($sid);
if($me!="$who") {
echo "<a href=\"gallery.php?action=addcomment&sid=$sid&who= $who&gid=$gid\">Add Comment</a>
";
}
echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
else if($action=="addcomment")
{
$who = $_GET["who"];
$gid = $_GET["gid"];
addonline(getuid_sid($sid),"Adding Photo Comments","");
echo "<card id=\"main\" title=\"GALLERY\">";
$uid = getuid_sid($sid);
$sql = "SELECT itemurl FROM fun_gallery WHERE id='".$gid."'";
echo "<p align=\"center\">";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$img = $item[0];
$lnk = "<img src=\"max.php?filename=$img\" alt=\"$id\"/>
";
echo "$lnk";
echo "<go href=\"genproc.php?action=commentadd&sid=$sid&gid= $gid\" method=\"post\">";
echo "<postfield name=\"text\" value=\"$(text)\"/>";
echo "</go>";
$vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_prate WHERE uid='".$uid."' AND pid='".$gid."'"));
if($vb[0]==0)
{
echo "Rate Photo: <select name=\"prate\">";
echo "<option value=\"1\">1</option>";
echo "<option value=\"2\">2</option>";
echo "<option value=\"3\">3</option>";
echo "<option value=\"4\">4</option>";
echo "<option value=\"5\">5</option>";
echo "<option value=\"6\">6</option>";
echo "<option value=\"7\">7</option>";
echo "<option value=\"8\">8</option>";
echo "<option value=\"9\">9</option>";
echo "<option value=\"10\">10</option>";
echo "</select>
";
}else{
$rinfo = mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(prate) as nofp FROM fun_prate WHERE pid='".$gid."'"));
$counts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_prate WHERE pid='".$gid."'"));
if($counts[0]>0) {
$ther = $rinfo[1]/$rinfo[0];
$rating = "Rating: $ther/$rinfo[1] (votes$counts[0])
";
}else{
$rating = "";
}
echo "$rating";
}
echo "Comment:
";
echo "<input name=\"text\" maxlength=\"150\"/>
";
echo "<anchor>Add";
echo "<go href=\"genproc.php?action=commentadd&sid=$sid&gid= $gid\" method=\"post\">";
echo "<postfield name=\"text\" value=\"$(text)\"/>";
echo "</go></anchor>
";
}
}
echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}else{
addonline(getuid_sid($sid),"Lost in user gallery lol","");
echo "<card id=\"main\" title=\"GALLERY\">";
echo "<p align=\"center\">";
echo "I don't know how did you get into here, but there's nothing to show
";
echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
echo "</wml>";
?>
---------------------------------------------------------------------------------------
else if($action=="comments")
{
$who = $_GET["who"];
$gid = $_GET["gid"];
addonline(getuid_sid($sid),"Viewing Photo Comments","");
echo "<card id=\"main\" title=\"GALLERY\">";
$uid = getuid_sid($sid);
//////ALL LISTS SCRIPT <<
if($page=="" || $page<=0)$page=1;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_galcomments WHERE pid='".$gid."'"));
$num_items = $noi[0]; //changable
$items_per_page= 5;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$sql = "SELECT id, pid, text, byuser, time FROM fun_galcomments WHERE pid='".$gid."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
echo "
";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
if(isonline($item[3]))
{
$iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
}else{
$iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
}
$snick = getnick_uid($item[3]);
$lnk = "<a href=\"index.php?action=viewuser&who=$item[3]&sid=$sid\">$iml$snick</a>:";
$bs = date("d m y-H:i:s",$item[4]);
echo "$lnk
";
$me = getuid_sid($sid);
if($who=="$me") {
$can = "a";
}else{
$can = "b";
}
if(ismod($uid)||$can=="a")
{
$delnk = "<a href=\"modproc.php?action=delcmt&sid=$sid&id=$item[0]\">[x]</a>";
}else{
$delnk = "";
}
$text = parsepm($item[2], $sid);
echo "$text $delnk
";
echo "$bs";
echo "
";
echo "";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"gallery.php?action=$action&page=$ppage&sid= $sid&who=$who&gid=$gid\">«PREV</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"gallery.php?action=$action&page=$npage&sid= $sid&who=$who&gid=$gid\">Next»</a>";
}
echo "
$page/$num_pages
";
if($num_pages>2)
{
$rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
$rets .= "<anchor>[GO]";
$rets .= "<go href=\"gallery.php\" method=\"get\">";
$rets .= "<postfield name=\"action\" value=\"$action\"/>";
$rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
$rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
$rets .= "</go></anchor>";
echo $rets;
}
echo "</p>";
////// UNTILL HERE >>
echo "<p align=\"center\">";
$me = getuid_sid($sid);
if($me!="$who") {
echo "<a href=\"gallery.php?action=addcomment&sid=$sid&who= $who&gid=$gid\">Add Comment</a>
";
}
echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
else if($action=="addcomment")
{
$who = $_GET["who"];
$gid = $_GET["gid"];
addonline(getuid_sid($sid),"Adding Photo Comments","");
echo "<card id=\"main\" title=\"GALLERY\">";
$uid = getuid_sid($sid);
$sql = "SELECT itemurl FROM fun_gallery WHERE id='".$gid."'";
echo "<p align=\"center\">";
$items = mysql_query($sql);
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$img = $item[0];
$lnk = "<img src=\"max.php?filename=$img\" alt=\"$id\"/>
";
echo "$lnk";
echo "<go href=\"genproc.php?action=commentadd&sid=$sid&gid= $gid\" method=\"post\">";
echo "<postfield name=\"text\" value=\"$(text)\"/>";
echo "</go>";
$vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_prate WHERE uid='".$uid."' AND pid='".$gid."'"));
if($vb[0]==0)
{
echo "Rate Photo: <select name=\"prate\">";
echo "<option value=\"1\">1</option>";
echo "<option value=\"2\">2</option>";
echo "<option value=\"3\">3</option>";
echo "<option value=\"4\">4</option>";
echo "<option value=\"5\">5</option>";
echo "<option value=\"6\">6</option>";
echo "<option value=\"7\">7</option>";
echo "<option value=\"8\">8</option>";
echo "<option value=\"9\">9</option>";
echo "<option value=\"10\">10</option>";
echo "</select>
";
}else{
$rinfo = mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(prate) as nofp FROM fun_prate WHERE pid='".$gid."'"));
$counts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_prate WHERE pid='".$gid."'"));
if($counts[0]>0) {
$ther = $rinfo[1]/$rinfo[0];
$rating = "Rating: $ther/$rinfo[1] (votes$counts[0])
";
}else{
$rating = "";
}
echo "$rating";
}
echo "Comment:
";
echo "<input name=\"text\" maxlength=\"150\"/>
";
echo "<anchor>Add";
echo "<go href=\"genproc.php?action=commentadd&sid=$sid&gid= $gid\" method=\"post\">";
echo "<postfield name=\"text\" value=\"$(text)\"/>";
echo "</go></anchor>
";
}
}
echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}else{
addonline(getuid_sid($sid),"Lost in user gallery lol","");
echo "<card id=\"main\" title=\"GALLERY\">";
echo "<p align=\"center\">";
echo "I don't know how did you get into here, but there's nothing to show
";
echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
echo "</p>";
echo "</card>";
}
echo "</wml>";
?>
Comment