Please Convert this Gallery Script to wml=)

Started on the old forum in August 2009 · view the original in the archive · old links redirect here

10 replies · 714 views · started 17 years ago · 1 min read

3 participants
zamaritan Junior · 26 posts #1
<?php
include("config.php");
include("core.php");
header("Cache-Control: no-cache, must-revalidate");            // Prevent caching, HTTP/1.1
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml'); 
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$bcon = connectdb();
if (!$bcon)
{
    echo "<head>";
    echo "<title>Error!!!</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/1.css\">";
    echo "</head>";
    echo "<body>";
    echo "<p align=\"center\">";
    echo "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
    echo "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
    echo "This error happens usually when backing up the database, please be patient...";
    echo "</p>";
    echo "</body>";
    echo "</html>";
    exit();
}
$brws = explode("/",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$uid = getuid_sid($sid);
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
cleardata();

if(isipbanned($uip,$ubr))
    {
      if(!isshield(getuid_sid($sid)))
      {
      echo "<head>";
      echo "<title>Error</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
      echo "This IP address is blocked<br/>";
      echo "<br/>";
      echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      //echo mysql_error();
      $remain =  $banto[0] - time();
      $rmsg = gettimemsg($remain);
      echo " IP: $rmsg<br/><br/>";
      
      echo "</p>";
      echo "<p>";
      echo "<form action=\"login.php\" method=\"get\">";
      echo "<b>Username: </b><br/><input name=\"loguid\" format=\"*x\" size=\"12\" maxlength=\"12\"/><br/>";
      echo "<b>Password: </b><br/><input type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
      echo "<br/><input name=\"Login\" type=\"submit\" value=\"Login\"></form>";
  echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
      }
    }
if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
      echo "<head>";
      echo "<title>Error</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/1.css\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
}
if(isbanned($uid))
    {
      echo "<head>";
      echo "<title>Error!!!</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
      echo "<b>You are Banned</b><br/><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
    $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "<b>Time Left: </b>$rmsg<br/>";
      $nick = getnick_uid($banto[2]);
    echo "<b>By: </b>$nick<br/>";
    echo "<b>Reason: </b>$banto[1]";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
////////////////////////////////////////main hehe
if ($action == "main") {
        addonline(getuid_sid($sid), "user gallery", "");
        echo "<head>";
                 echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
                echo"<div class=\"top\"><b>Site Gallery</b></div><br/>";

 echo "<p align=\"center\">";
echo "<br/><b>Random Gallery</b><br/>";
$sql=mysql_fetch_array(mysql_query("SELECT uid, itemurl  FROM ibwf_gallery ORDER BY RAND() LIMIT 1"));
$nick = getnick_uid($sql[0]);
echo " <img src=\"../gallery/files/$sql[1]\" alt=\"$sql[0]\" width=\"30\" height=\"40\"/>";

$sql=mysql_fetch_array(mysql_query("SELECT uid, itemurl  FROM ibwf_gallery ORDER BY RAND() LIMIT 1"));
$nick = getnick_uid($sql[0]);
echo " <img src=\"../gallery/files/$sql[1]\" alt=\"$sql[0]\" width=\"30\" height=\"40\"/>";

$sql=mysql_fetch_array(mysql_query("SELECT uid, itemurl  FROM ibwf_gallery ORDER BY RAND() LIMIT 1"));
$nick = getnick_uid($sql[0]);
echo " <img src=\"../gallery/files/$sql[1]\" alt=\"$sql[0]\" width=\"30\" height=\"40\"/></p>";

        $males = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery WHERE sex='M'"));
        echo "<a href=\"gallery.php?action=male&sid=$sid\">• Male Gallery($males[0])<br/>";
        $females = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery WHERE sex='F'"));
        echo "<a href=\"gallery.php?action=female&sid=$sid\">• Female Gallery($females[0])<br/>";
                $all = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery "));
        echo "<a href=\"gallery.php?action=all&sid=$sid\">• All Gallery($all[0])<br/>";
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gallery WHERE uid='".$uid."'"));
                echo "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$uid\">• My Gallery($noi[0])</a><br/>";
                
                echo "<br/>";
        ///echo "<a href=\"../gallery/upload.php?sid=&$sid=web\">• Upload Photo Via Device</a><br/>";
                echo "<a href=\"../gallery/upload.php?sid=$sid&site=$site\">Upload via Device</a><br/>";

        echo "</p><p align=\"center\">";
        echo "<a href=\"index.php?action=main&sid=$sid\">";
        echo "Main Menu</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action == "male") {
        addonline(getuid_sid($sid), "Viewing Male Gallery", "");
        $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_gallery WHERE sex='M'"));
        } else {
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery WHERE sex='M'"));
        }
        $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 DISTINCT uid FROM ibwf_gallery WHERE sex='M' ORDER BY uid ASC LIMIT $limit_start, $items_per_page";
        echo "<head>";
        echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $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_gallery WHERE uid='".$who."'"));
                $lnk = "<a href=\"gallery.php?action=viewuser&who=$who&sid=$sid\">$user($countpics[0])</a><br/>";
                echo "$lnk";
            }
        }
        echo "</p>";
        echo "<p align=\"center\">";
        if ($page > 1) {
            $ppage = $page-1;
            echo "<a href=\"gallery.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> ";
        }
        if ($page < $num_pages) {
            $npage = $page+1;
            echo "<a href=\"gallery.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if ($num_pages > 2) {
            $rets = "<form action=\"gallery.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 .= "</form>";
            echo $rets;
        }
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\">";
        echo "Main Menu</a>";
        echo "</p>";
        echo "</body>";
    }
else if($action == "all") {
        addonline(getuid_sid($sid), "Viewing all Gallery", "");
        $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_gallery "));
        } else {
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery "));
        }
        $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 DISTINCT uid FROM ibwf_gallery  ORDER BY uid ASC LIMIT $limit_start, $items_per_page";
        echo "<head>";
        echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $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_gallery WHERE uid='".$who."'"));
                $lnk = "<a href=\"gallery.php?action=viewuser&who=$who&sid=$sid\">$user($countpics[0])</a><br/>";
                echo "$lnk";
            }
        }
        echo "</p>";
        echo "<p align=\"center\">";
        if ($page > 1) {
            $ppage = $page-1;
            echo "<a href=\"gallery.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> ";
        }
        if ($page < $num_pages) {
            $npage = $page+1;
            echo "<a href=\"gallery.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if ($num_pages > 2) {
            $rets = "<form action=\"gallery.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 .= "</form>";
            echo $rets;
        }
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\">";
        echo "Main Menu</a>";
        echo "</p>";
        echo "</body>";
    }
 
    else if($action == "female") {
        addonline(getuid_sid($sid), "Viewing Female Gallery", "");
        $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_gallery WHERE sex='F'"));
        } else {
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery WHERE sex='F'"));
        }
        $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 DISTINCT uid FROM ibwf_gallery WHERE sex='F' ORDER BY uid ASC LIMIT $limit_start, $items_per_page";
        echo "<head>";
        echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
        $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_gallery WHERE uid='".$who."'"));
                $lnk = "<a href=\"gallery.php?action=viewuser&who=$who&sid=$sid\">$user($countpics[0])</a><br/>";
                echo "$lnk";
            }
        } else {
            echo "female gallery is empty";
        }
        echo "</p>";
        echo "<p align=\"center\">";
        if ($page > 1) {
            $ppage = $page-1;
            echo "<a href=\"gallery.php?action=$action&page=$ppage&sid=$sid\">«PREV</a> ";
        }
        if ($page < $num_pages) {
            $npage = $page+1;
            echo "<a href=\"gallery.php?action=$action&page=$npage&sid=$sid\">Next»</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if ($num_pages > 2) {
            $rets = "<form action=\"gallery.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 .= "</form>";
            echo $rets;
        }
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\">";
        echo "Main Menu</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action == "viewuser") {
        $who = $_GET["who"];
        addonline(getuid_sid($sid), "Viewing user Photos", "");
        $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_gallery WHERE uid='".$who."'"));
        } else {
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gallery"));
        }
        $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_gallery WHERE uid='".$who."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        } else {
            $sql = "SELECT id, sex, itemurl, uid FROM ibwf_gallery  ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        }
        echo "<head>";
        echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        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=\"../gallery/files/$img\" alt=\"$id\" width=\"90\" height=\"100\"/><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($counts[0]))<br/>";
                } else {
                    $rating = "";
                }
                $gall = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_galcomments WHERE pid='".$id."'"));
                $me = getuid_sid($sid);
                if ($who == "$me") {
                                $use = "<a href=\"data.php?action=upavg&sid=$sid&avsrc=../gallery/files/$img\">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=\"../gallery/files/$img\">Download Photo</a><br/>$use$delnk<br/><a href=\"gallery.php?who=$who&action=comments&sid=$sid&gid=$item[0]\">Comments($gall[0])</a><br/>";
            echo"<a href=\"gallery.php?action=viewuser&page=$ppage&sid=$sid&who=$who&site=1\">Order By Full Size</a><br/>";
                        $user = getnick_uid($who);
                        echo"By: <a href=\"index.php?action=viewuser&who=$who&sid=$sid\">$user</a><br/>";
}
        }
        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\">«PREV</a> ";
        }
        if ($page < $num_pages) {
            $npage = $page+1;
            echo "<a href=\"gallery.php?action=$action&page=$npage&sid=$sid&who=$who\">Next»</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if ($num_pages > 2) {
            $rets = "<form action=\"gallery.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=\"who\" value=\"$who\"/>";
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
            $rets .= "</form>";
            echo $rets;
        }
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>";
        echo "</p>";
        echo "</body>";
}
    else if($action == "viewuser2") {
        $who = $_GET["who"];
        addonline(getuid_sid($sid), "Viewing user Photos", "");
        $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_gallery WHERE uid='".$who."'"));
        } else {
            $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_gallery"));
        }
        $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_gallery WHERE uid='".$who."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        } else {
            $sql = "SELECT id, sex, itemurl, uid FROM ibwf_gallery  ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        }
        echo "<head>";
        echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        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=\"../gallery/files/$img\" alt=\"$id\"/><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($counts[0]))<br/>";
                } else {
                    $rating = "";
                }
                $gall = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_galcomments WHERE pid='".$id."'"));
                $me = getuid_sid($sid);
                if ($who == "$me") {
                                     $use = "<a href=\"data.php?action=upavg&sid=$sid&avsrc=../gallery/files/$img\">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=\"../gallery/files/$img\">Download Photo</a><br/>$use$delnk<br/><a href=\"gallery.php?who=$who&action=comments&sid=$sid&gid=$item[0]\">Comments($gall[0])</a><br/>";
            echo"<a href=\"gallery.php?who=$who&action=viewuser&sid=$sid&gid=$item[0]\">Order By Normal Size</a><br/>";
                        $user = getnick_uid($who);
                        echo"By: <a href=\"index.php?action=viewuser&who=$who&sid=$sid\">$user</a><br/>";
}
        }
        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\">«PREV</a> ";
        }
        if ($page < $num_pages) {
            $npage = $page+1;
            echo "<a href=\"gallery.php?action=$action&page=$npage&sid=$sid&who=$who\">Next»</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if ($num_pages > 2) {
            $rets = "<form action=\"gallery.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=\"who\" value=\"$who\"/>";
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
            $rets .= "</form>";
            echo $rets;
        }
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\">Main Menu</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action == "comments") {
        $who = $_GET["who"];
        $gid = $_GET["gid"];
        addonline(getuid_sid($sid), "Viewing Photo Comments", "");
        $uid = getuid_sid($sid);
        //////ALL LISTS SCRIPT <<
        if ($page == "" || $page <= 0)$page = 1;
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_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 ibwf_galcomments WHERE pid='".$gid."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        echo "<head>";
        echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        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=\"modproc.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=\"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 "<br/>$page/$num_pages<br/>";
        if ($num_pages > 2) {
            $rets = "<form action=\"gallery.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=\"who\" value=\"$who\"/>";
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
            $rets .= "<input type=\"hidden\" name=\"gid\" value=\"$gid\"/>";
            $rets .= "</form>";
            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><br/>";
        }
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
        echo "Home</a>";
        echo "</p>";
        echo "</body>";
    }
    else if($action == "addcomment") {
        $who = $_GET["who"];
        $gid = $_GET["gid"];
        addonline(getuid_sid($sid), "Adding Photo Comments", "");
        $uid = getuid_sid($sid);
        $sql = "SELECT itemurl FROM ibwf_gallery  WHERE id='".$gid."'";
        echo "<head>";
        echo "<title>user gallery</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
        echo "<body>";
        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\"/><br/>";
                echo "$lnk";
                echo "<form action=\"genproc.php?action=commentadd&sid=$sid&gid=$gid\" method=\"post\">";
                $vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_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><br/>";
                } else {
                    $rinfo = mysql_fetch_array(mysql_query("SELECT COUNT(*) as nofr, SUM(prate) as nofp FROM ibwf_prate WHERE pid='".$gid."'"));
                    $counts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_prate WHERE pid='".$gid."'"));
                    if ($counts[0] > 0) {
                        $ther = $rinfo[1]/$rinfo[0];
                        $rating = "Rating: $ther/$rinfo[1] (votes($counts[0]))<br/>";
                    } else {
                        $rating = "";
                    }
                    echo "$rating";
                }
                echo "Comment:<br/>";
                echo "<input type=\"text\" maxlength=\"150\" name=\"text\"/><br/>";
                echo "<input type=\"submit\" value=\"Add\"/>";
                echo "</form>";
            }
        }
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
        echo "Home</a>";
        echo "</p>";
        echo "</body>";
    } else {
        addonline(getuid_sid($sid), "Lost in user gallery lol", "");
        echo "<p align=\"center\">";
        echo "I don't know how did you get into here, but there's nothing to show<br/><br/>";
        echo "<a href=\"gallery.php?action=main&sid=$sid\">User Gallery</a><br/>";
        echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
        echo "Home</a>";
        echo "</p>";
    }
    echo "</body>";
    echo "</html>";
?>
</html>

jsyguy23 Developer · 134 posts #2

y not use the wml version???????8)

kei_ki7 Senior · 431 posts #5

Zamaritan do you have a demo for this script ??

Did I help you? You can help me too Your donations will help me finance my studies.

kei_ki7 Senior · 431 posts #7

..thanks i will check this

Did I help you? You can help me too Your donations will help me finance my studies.

kei_ki7 Senior · 431 posts #8

Wow this is nice script 😀

Did I help you? You can help me too Your donations will help me finance my studies.

zamaritan Junior · 26 posts #9

did u like my script?hehe thanks .i just modefy that script from old lavalair gallery..i put upload via device insted of via url....i hope somebody can help me to convert it into wml=)..

kei_ki7 Senior · 431 posts #10

I will try 🙂 even im a newbie in coding 😀

Did I help you? You can help me too Your donations will help me finance my studies.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close