usage
index.php
index.php?action=viewuser
genproc.php
lists.php
who can help me to make the sql ibwf_prate and ibwf_galcom
l
Code:
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gallery3")); echo "<br/><a href=\"index.php?action=pkgal&sid=$sid\">Uploader Photo($noi[0])</a><br/>";
Code:
else if($action=="pkgal") { addonline(getuid_sid($sid),"Users Gallery","index.php?action=$action"); echo "<p align=\"left\">"; echo "Users Gallery<br/>"; $males = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery3 WHERE sex='M'")); echo "<a href=\"lists.php?action=boys&sid=$sid\">Boys Gallery($males[0])</a><br/>"; $females = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery3 WHERE sex='F'")); echo "<a href=\"lists.php?action=girls&sid=$sid\">Girls Gallery($females[0])</a><br/>"; echo "</p>"; echo "<p align=\"center\">"; echo "<a href=\"http://wap.net.ph/gallery2/upload.php?sid=$sid\">Uploader Photo via Device</a><br/>"; echo "<a href=\"index.php?action=addgal&sid=$sid\">Upload Photo via url</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">"; echo "Main menu</a>"; echo "</p>"; } else if($action=="addgal") { addonline(getuid_sid($sid),"Galleries","index.php?action=addgal"); echo "<title>v2: Add Photos</title>"; echo "<left>"; echo "<b>Add PICS</b><br/><br/>"; echo "<form action=\"genproc.php?action=addgal&sid=$sid\" method=\"post\">"; echo "Image URL: <input name=\"itemurl\" type=\"text\" value=\"http://\"/><br/>"; echo "<br/><input type=\"submit\" value=\"Add Photo\"/>"; echo "</form>"; echo "<br/><br/><a href=\"index.php?action=main&sid=$sid\">"; echo "Main menu</a>"; echo "</p>"; }
Code:
echo "<a href=\"lists.php?action=viewuser&who=$who&sid=$sid\">View gallery</a><br/>";
Code:
else if($action=="delgal") { $gid = $_GET["gid"]; echo "<title>Gallery</title>"; echo "<p align=\"center\">"; echo "<br/>"; $res = mysql_query("DELETE FROM ibwf_gallery3 WHERE id='".$gid."'"); if($res){ echo "Deleted successfully"; }else{ echo ">Error! Please Try again!"; } echo "<br/><a href=\"index.php?action=main&sid=$sid\">"; echo "Main menu</a>"; echo "</p>"; } else if($action=="addgal") { $itemurl = $_POST["itemurl"]; addonline(getuid_sid($sid),"Adding A Pic","index.php?action=main"); echo "<p align=\"center\">"; $nopl = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$who."'")); $uid = getuid_sid($sid); $nopl = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'")); if($nopl[0]=='M') { $usex = "M"; }else if($nopl[0]=='F'){ $usex = "F"; }else{ $usex = "M"; } $res = mysql_query("INSERT INTO ibwf_gallery3 SET uid='".$uid."', itemurl='".$itemurl."', sex='".$usex."'"); if($res) { echo "User Photo Added<br/>"; }else{ echo "Database Error<br/>"; } echo "<a href=\"index.php?action=usergal&sid=$sid&browse?start\">User Gallery</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid&type=send&browse?start\">"; echo "Main menu</a>"; echo "</p>"; } else if($action=="addcom2") { $text = $_POST["text"]; $prate = $_POST["prate"]; $gid = $_GET["gid"]; addonline(getuid_sid($sid),"Adding Photo Comment","index.php?action=main"); echo "<card id=\"main\" title=\"Add Photo\">"; echo "<p align=\"center\">"; $crdate = time(); $uid = getuid_sid($sid); $res = false; if(trim($text)!="") { $res = mysql_query("INSERT INTO ibwf_galcom SET text='".$text."', byuser='".$uid."', time='".$crdate."', pid='".$gid."'"); } if($res) { echo "Comment Added Successfully<br/>"; }else{ echo "Error Adding Comment<br/>"; } if($prate!="") { $res2 = mysql_query("INSERT INTO ibwf_prate SET uid='".$uid."', pid='".$gid."', prate='".$prate."'"); if($res2) { echo "Photo rated successfully<br/>"; }else{ echo "Database Error!<br/>"; } } echo "<a href=\"index.php?action=pkgal&sid=$sid\">Users Gallery</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">"; echo "Main</a>"; echo "</p>"; echo "</body>"; }
Code:
/////////////////////////////////////Comments else if($action=="comments2") { $who = $_GET["who"]; $gid = $_GET["gid"]; $whonick = getnick_uid($who); addonline(getuid_sid($sid),"Viewing Photo Comments of $whonick","lists.php?action=$action&who=$who&gid=$gid"); addplace(getuid_sid($sid),"lists.php?action=$action&who=$who&gid=$gid",""); echo "<title>Photo Comments</title>"; $uid = getuid_sid($sid); //////ALL LISTS SCRIPT << if($page=="" || $page<=0)$page=1; $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_galcom 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 ibwf_galcom WHERE pid='".$gid."' ORDER BY id DESC LIMIT $limit_start, $items_per_page"; echo "<p>"; $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<br/><small>"; $me = getuid_sid($sid); if($who=="$me") { $can = "a"; }else{ $can = "b"; } if(ismod($uid)||$can=="a") { $delnk = "<a href=\"genproc.php?action=delcmt&sid=$sid&id=$item[0]\">[x]</a>"; }else{ $delnk = ""; } $text = parsepm($item[2], $sid); echo "$text $delnk<br/>"; echo "$bs"; echo "<br/>"; echo "</small>"; } } echo "</p>"; echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"lists.php?action=$action&page=$ppage&sid=$sid&who=$who&gid=$gid\">«PREV</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"lists.php?action=$action&page=$npage&sid=$sid&who=$who&gid=$gid\">Next»</a>"; } echo "<br/>$page/$num_pages<br/>"; if($num_pages>2) { $rets .= "<form action=\"lists.php\" method=\"get\">"; $rets .= "Jump to page<input name=\"page\" format=\"*N\" size=\"3\"/>"; $rets .= "<input type=\"submit\" value=\"GO\"/>"; $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"; $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"; $rets .= "<input type=\"hidden\" name=\"who\" value=\"$who\"/>"; $rets .= "</form>"; echo $rets; } echo "</p>"; ////// UNTILL HERE >> echo "<p align=\"center\">"; $me = getuid_sid($sid); if($me!="$who") { echo "<a href=\"index.php?action=addcom&sid=$sid&who=$who&gid=$gid\">Add Comment</a><br/>"; } echo "<a href=\"index.php?action=usergal&sid=$sid\">User Gallery</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">"; echo "Main menu</a>"; echo "</p>"; } /////////////////////////////////////Gwapos else if($action=="boys") { addonline(getuid_sid($sid),"Viewing Boys Gallery","lists.php?action=$action"); addplace(getuid_sid($sid),"lists.php?action=$action","lists.php?action=$action"); $uid = getuid_sid($sid); //////ALL gallery SCRIPT << if($page=="" || $page<=0)$page=1; if($who!="") { $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery3 WHERE sex='M'")); }else{ $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery3 WHERE sex='M'")); } $num_items = $noi[0]; //changable $items_per_page= 8; $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 DISTINCT uid FROM ibwf_gallery3 WHERE sex='M' ORDER BY uid ASC LIMIT $limit_start, $items_per_page"; echo "<p><small>"; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $who = $item[0]; $user=getnick_uid($who); $countpics = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_gallery3 WHERE uid='".$who."'")); $lnk = "<a href=\"lists.php?action=viewuser&who=$who&sid=$sid\">$user($countpics[0])</a><br/>"; echo "$lnk"; } }else{ echo "Boys gallery is empty"; } echo "</small></p>"; echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"lists.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"lists.php?action=$action&page=$npage&sid=$sid\">Next»</a>"; } echo "<br/>$page/$num_pages<br/>"; if($num_pages>2) { $rets = "<form action=\"lists.php\" method=\"get\">"; $rets .= "Jump to page<input name=\"page\" format=\"*N\" size=\"3\"/>"; $rets .= "<input type=\"submit\" value=\"GO\"/>"; $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"; $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"; $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>"; $rets .= "</form>"; echo $rets; } $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".$uid."'")); $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'")); $unrd="".$unreadinbox[0].""; if ($unreadinbox[0]>0) { echo "<a href=\"inbox.php?action=main&sid=$sid&type=send\">$unrd new pm</a>"; } echo "<br/><a href=\"index.php?action=pkgal&sid=$sid\">User Gallery</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">"; echo "Main menu</a>"; echo "</p>"; echo "</body>"; } /////////////////////////////////////Gwapas else if($action=="girls") { addonline(getuid_sid($sid),"Viewing Girls Gallery","lists.php?action=$action"); addplace(getuid_sid($sid),"lists.php?action=$action","lists.php?action=$action"); $uid = getuid_sid($sid); //////ALL gallery SCRIPT << if($page=="" || $page<=0)$page=1; if($who!="") { $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery3 WHERE sex='F'")); }else{ $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery3 WHERE sex='F'")); } $num_items = $noi[0]; //changable $items_per_page= 8; $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 DISTINCT uid FROM ibwf_gallery3 WHERE sex='F' ORDER BY uid ASC LIMIT $limit_start, $items_per_page"; echo "<p><small>"; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $who = $item[0]; $user=getnick_uid($who); $countpics = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM ibwf_gallery3 WHERE uid='".$who."'")); $lnk = "<a href=\"lists.php?action=viewuser&who=$who&sid=$sid\">$user($countpics[0])</a><br/>"; echo "$lnk"; } }else{ echo "Girls gallery is empty"; } echo "</small></p>"; echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"lists.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"lists.php?action=$action&page=$npage&sid=$sid\">Next»</a>"; } echo "<br/>$page/$num_pages<br/>"; if($num_pages>2) { $rets = "<form action=\"lists.php\" method=\"get\">"; $rets .= "Jump to page<input name=\"page\" format=\"*N\" size=\"3\"/>"; $rets .= "<input type=\"submit\" value=\"GO\"/>"; $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"; $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"; $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>"; $rets .= "</form>"; echo $rets; } $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".$uid."'")); $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'")); $unrd="".$unreadinbox[0].""; if ($unreadinbox[0]>0) { echo "<a href=\"inbox.php?action=main&sid=$sid&type=send\">$unrd New MSG</a>"; } echo "<br/><a href=\"index.php?action=pkgal&sid=$sid\">Users Gallery</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">"; echo "Main</a>"; echo "</p>"; echo "</body>"; } /////////////////////////////////////all gal else if($action=="viewuser") { $who = $_GET["who"]; $whonick = getnick_uid($who); addonline(getuid_sid($sid),"Viewing Photos of $whonick","lists.php?action=$action&who=$who"); addplace(getuid_sid($sid),"lists.php?action=$action&who=$who",""); $uid = getuid_sid($sid); //////ALL gallery SCRIPT << if($page=="" || $page<=0)$page=1; if($who!="") { $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gallery3 WHERE uid='".$who."'")); }else{ $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gallery3")); } $num_items = $noi[0]; //changable $items_per_page= 1; $num_pages = ceil($num_items/$items_per_page); if(($page>$num_pages)&&$page!=1)$page= $num_pages; $limit_start = ($page-1)*$items_per_page; if($who!="") { $sql = "SELECT id, sex, itemurl FROM ibwf_gallery3 WHERE uid='".$who."' ORDER BY id DESC LIMIT $limit_start, $items_per_page"; }else{ $sql = "SELECT id, sex, itemurl, uid FROM ibwf_gallery3 ORDER BY id DESC LIMIT $limit_start, $items_per_page"; } echo "<p align=\"center\">"; $items = mysql_query($sql); echo mysql_error(); if(mysql_num_rows($items)>0) { while ($item = mysql_fetch_array($items)) { $id = $item[0]; $img = $item[2]; $lnk = "<img src=\"$img\" alt=\"$id\" width=\"100\" height=\"80\"/><br/>"; $rinfo = mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(prate) as nofp FROM ibwf_prate WHERE pid='".$id."'")); $counts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_prate WHERE pid='".$id."'")); if($counts[0]>0) { $ther = $rinfo[1]/$rinfo[0]; $rating = "Rating: $ther/$rinfo[1] votes <b>($counts[0])</b><br/>"; }else{ $rating = ""; } $gall = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_galcom WHERE pid='".$id."'")); $me = getuid_sid($sid); if($who=="$me") { $use = "<a href=\"genproc.php?action=upav2&sid=$sid&gid=$item[0]\">Use as Avatar</a> | "; }else{ $use = ""; } if(candelgal($uid, $item[0])) { $delnk = "<a href=\"genproc.php?action=delgal&sid=$sid&gid=$item[0]\">Remove Photo</a>"; }else{ $delnk = ""; } echo "$lnk$rating<a href=\"$img\">Download</a><br/> $use$delnk<br/><a href=\"lists.php?who=$who&action=comments2&sid=$sid&gid=$item[0]\">Comments($gall[0])</a><br/>"; } } echo "</p>"; echo "<p align=\"center\">"; if($page>1) { $ppage = $page-1; echo "<a href=\"lists.php?action=$action&page=$ppage&sid=$sid&who=$who\">«PREV</a> "; } if($page<$num_pages) { $npage = $page+1; echo "<a href=\"lists.php?action=$action&page=$npage&sid=$sid&who=$who\">Next»</a>"; } echo "<br/>$page/$num_pages<br/>"; if($num_pages>2) { $rets = "<form action=\"lists.php\" method=\"get\">"; $rets .= "Jump to page<input name=\"page\" format=\"*N\" size=\"3\"/>"; $rets .= "<input type=\"submit\" value=\"GO\"/>"; $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"; $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"; $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>"; $rets .= "</form>"; echo $rets; } echo "<a href=\"index.php?action=pkgal&sid=$sid\">Users Gallery</a><br/>"; echo "<a href=\"index.php?action=main&sid=$sid\">Main menu</a>"; echo "</p>"; echo "</body>"; }
Code:
-- Table structure for table `ibwf_gallery3` -- CREATE TABLE IF NOT EXISTS `ibwf_gallery3` ( `id` int(11) NOT NULL DEFAULT '0', `uid` int(11) NOT NULL DEFAULT '0', `sex` text NOT NULL, `itemurl` int(11) NOT NULL DEFAULT '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `ibwf_gallery3` --
Comment