User Gallery Script

Started on the old forum in January 2007 · view the original in the archive · old links redirect here

19 replies · 1,785 views · started 19 years ago · 2 min read

3 participants
wizard Senior · 493 posts #1

the script only shows the photo of user with uid 1 in the male gallery but the other photos are in the database. can someone help me with it please. to c the problem look at my site http://www.funmobile.ws and check user gallery. try to add ur own photo n c

<?php

include("core.php");
include("config.php");

header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";

    echo "<head>";

    echo "<title>$stitle</title>";
    echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
echo "
<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Fun mobile :)\"> 
<meta name=\"keywords\" content=\"free, community, forums, chat, wap, communicate\">
";
    echo "</head>";

    echo "<body>";
connectdb();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];

if(islogged($sid)==false)
{
    
      echo "<p align=\"center\">";
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      exit();
}
$uid = getuid_sid($sid);
if(isbanned($uid))
    {
        
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "You are [b]Banned[/b]
";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM fun_penalties WHERE uid='".$uid."' AND penalty='1'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg

";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      exit();
    }

if($action=="main")
{
  addonline(getuid_sid($sid),"user gallery","");
  
  echo "<p align=\"center\">";
echo "Send your photos to [email]gallery@funmobile.ws[/email] with username and password
";
echo "Your pictures will be added within 2 days after being sent!";
echo "</p>

";
echo "<a href=\"gallery.php?action=male&sid=$sid\">Male Gallery
";
echo "<a href=\"gallery.php?action=female&sid=$sid\">Female Gallery
";

echo "</p><p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    

}
else if($action=="gallery")
{
  addonline(getuid_sid($sid),"Adding Photo","");
  
  echo "<p align=\"center\">";
echo "If you have a url to ur photo u may add it to the gallery below

";
echo "<form action=\"genproc.php?action=addphoto&sid=$sid\" method=\"post\">";  
echo "Image URL: <input name=\"imglink\" type=\"text\"/>
";
echo "Sex: <select name=\"sex\">";
echo "<option value=\"M\">Male</option>";
echo "<option value=\"F\">Female</option>";
echo "</select>";
echo "
<input type=\"submit\" value=\"Add Photo\"/>";
echo "</form>"; 

  echo "

";
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>";
    

}
else if($action=="male")
{
  addonline(getuid_sid($sid),"Male gallery","");
  
  echo "

";
$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(uid) FROM fun_gallery WHERE sex='M' "));

    if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $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;

$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid $limit_start, $items_per_page;"));
if($getgalusers) {
$user = getnick_uid($getgalusers[1]);
$who = $getgalusers[1];
$link = "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$user</a>
";    
echo $link;
}else{
echo "Male User 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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 "
";
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>";
    

}
else if($action=="female")
{
  addonline(getuid_sid($sid),"Female gallery","");
echo "

";

$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(uid) FROM fun_gallery WHERE sex='F'")); 

if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $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;

 
$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='F' ORDER BY uid $limit_start, $items_per_page;"));
if($getgalusers) {
$user = getnick_uid($getgalusers[1]);
$who = $getgalusers[1];
$link = "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$user</a>
";    
echo $link;
}else{
echo "Female User 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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 "
";
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>";
    

}
else if($action=="viewuser")
{
  addonline(getuid_sid($sid),"viewing user pics","");
$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM fun_gallery WHERE uid='".$who."'")); 

if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $items_per_page= 3;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

 
$getphotos = mysql_fetch_array(mysql_query("SELECT id, imglink FROM fun_gallery WHERE uid='".$who."' ORDER BY id $limit_start, $items_per_page;"));
  echo "

";
if($getphotos) {
$img = "<img src=\"$getphotos[1]\" alt=\"$getphotos[0]\"/>
";
$dnl = "<a href=\"$getphotos[1]\">Download</a>

";
echo "$img$dnl";
}

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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 .= "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
        $rets .= "</form>";

        echo $rets;
    }

  echo "
";
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>";
    

}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

";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
}

    echo "</body>";
    echo "</html>";
?>
GumSlone Administrator Principal · 1,690 posts #2
$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid $limit_start, $items_per_page;"));

IS wrong you have forgotten LIMIT!

$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid LIMIT $limit_start, $items_per_page"));

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

wizard Senior · 493 posts #3
$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid $limit_start, $items_per_page;"));

IS wrong you have forgotten LIMIT!

$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid LIMIT $limit_start, $items_per_page"));

thanks gums but there is still something wrong. it still doesnt show all the records and all the imges check my site n c. here is the code im using

<?php

include("core.php");
include("config.php");

header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";

    echo "<head>";

    echo "<title>$stitle</title>";
    echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
echo "
<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />
<meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>
<meta name=\"description\" content=\"Fun mobile :)\"> 
<meta name=\"keywords\" content=\"free, community, forums, chat, wap, communicate\">
";
    echo "</head>";

    echo "<body>";
connectdb();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];

if(islogged($sid)==false)
{
    
      echo "<p align=\"center\">";
      echo "You are not logged in
";
      echo "Or Your session has been expired

";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      exit();
}
$uid = getuid_sid($sid);
if(isbanned($uid))
    {
        
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>
";
      echo "You are [b]Banned[/b]
";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM fun_penalties WHERE uid='".$uid."' AND penalty='1'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg

";
      //echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      exit();
    }

if($action=="main")
{
  addonline(getuid_sid($sid),"user gallery","");
  
  echo "<p align=\"center\">";
echo "Send your photos to [email]gallery@funmobile.ws[/email] with username and password
";
echo "Your pictures will be added within 2 days after being sent!";
echo "</p>

";
echo "<a href=\"gallery.php?action=male&sid=$sid\">Male Gallery
";
echo "<a href=\"gallery.php?action=female&sid=$sid\">Female Gallery
";
echo "<a href=\"gallery.php?action=gallery&sid=$sid\">+ Add Photo</a>";
echo "</p><p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
    

}
else if($action=="gallery")
{
  addonline(getuid_sid($sid),"Adding Photo","");
  
  echo "<p align=\"center\">";
echo "If you have a url to ur photo u may add it to the gallery below

";
echo "<form action=\"genproc.php?action=addphoto&sid=$sid\" method=\"post\">";  
echo "Image URL: <input name=\"imglink\" type=\"text\"/>
";
echo "Sex: <select name=\"sex\">";
echo "<option value=\"M\">Male</option>";
echo "<option value=\"F\">Female</option>";
echo "</select>";
echo "
<input type=\"submit\" value=\"Add Photo\"/>";
echo "</form>"; 

  echo "

";
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>";
    

}
else if($action=="male")
{
  addonline(getuid_sid($sid),"Male gallery","");
  
  echo "

";
$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_gallery WHERE sex='M' "));

    if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $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;

$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid LIMIT $limit_start, $items_per_page"));
if($getgalusers) {
$user = getnick_uid($getgalusers[1]);
$who = $getgalusers[1];
$link = "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$user</a>
";    
echo $link;
}else{
echo "Male User 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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 "
";
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>";
    

}
else if($action=="female")
{
  addonline(getuid_sid($sid),"Female gallery","");
echo "

";

$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_gallery WHERE sex='F'")); 

if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $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;

 
$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='F' ORDER BY uid LIMIT $limit_start, $items_per_page"));
if($getgalusers) {
$user = getnick_uid($getgalusers[1]);
$who = $getgalusers[1];
$link = "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$user</a>
";    
echo $link;
}else{
echo "Female User 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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 "
";
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>";
    

}
else if($action=="viewuser")
{
  addonline(getuid_sid($sid),"viewing user pics","");
$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_gallery WHERE uid='".$who."'")); 

if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $items_per_page= 3;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

 
$getphotos = mysql_fetch_array(mysql_query("SELECT id, imglink FROM fun_gallery WHERE uid='".$who."' ORDER BY id LIMIT $limit_start, $items_per_page"));
  echo "

";
if($getphotos) {
$img = "<img src=\"$getphotos[1]\" alt=\"$getphotos[0]\"/>
";
$dnl = "<a href=\"$getphotos[1]\">Download</a>

";
echo "$img$dnl";
}

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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 .= "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
        $rets .= "</form>";

        echo $rets;
    }

  echo "
";
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>";
    

}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

";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
  echo "</p>";
}

    echo "</body>";
    echo "</html>";
?>

and these r my databse records for the gallery table

INSERT INTO fun_gallery VALUES (1, 1, '[url]http://funmobile.ws/images/logo.gif'[/url], 'M');
INSERT INTO fun_gallery VALUES (2, 1, '[url]http://funmobile.ws/images/login.gif'[/url], 'M');
INSERT INTO fun_gallery VALUES (3, 21, '[url]http://fimizone.org/forum/images/logo.gif'[/url], 'M');
INSERT INTO fun_gallery VALUES (4, 21, '[url]http://fimizone.org/forum/images/login.gif'[/url], 'M');
INSERT INTO fun_gallery VALUES (5, 37, '[url]http://htportal.net'[/url], 'M');
INSERT INTO fun_gallery VALUES (6, 26, '[url]http://prowap.biz/images/logo.gif'[/url], 'M');
INSERT INTO fun_gallery VALUES (7, 101, '[url]http://metalmafia.co.uk/uploader/ghostskull.gif'[/url], 'M');
INSERT INTO fun_gallery VALUES (8, 13, '', 'F');
INSERT INTO fun_gallery VALUES (9, 11, 'C:/Documents and settings', 'F');
INSERT INTO fun_gallery VALUES (10, 11, 'C:\\Documents and Settings\\grave\\Local Settings\\Temp\\Rar$ML06.062\\cece.rar', 'M');
INSERT INTO fun_gallery VALUES (11, 11, 'C:\\Documents and Settings\\grave\\Local Settings\\Temp\\Rar$ML01.906\\cece.rar', 'F');
INSERT INTO fun_gallery VALUES (12, 28, '[url]http://clevy.net'[/url], 'M');
Guest #4

Please upload sql table for gallery file

wizard Senior · 493 posts #6
else if($action=="male")
{
  addonline(getuid_sid($sid),"Male gallery","");
  
  echo "

";
$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_gallery WHERE sex='M' "));

    if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $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;

$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid LIMIT $limit_start, $items_per_page"));
if($getgalusers) {
$user = getnick_uid($getgalusers[1]);
$who = $getgalusers[1];
$link = "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$user</a>
";    
echo $link;
}else{
echo "Male User 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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 "
";
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>";
    

}

i have a problem there. it doesnt show all the male users who have records in the gallery even though the record is in the db

GumSlone Administrator Principal · 1,690 posts #7

Everything looks fine, please post the sql table or just row names of your table, possible that the row names dont match.

$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid LIMIT $limit_start, $items_per_page"));

add after order by uid the way how do you want to order desc for descending and asc for ascending

i think i have found the bug, here is the code which schould work. i havnt tested it.

$getgalusers = mysql_fetch_array(mysql_query("SELECT `id`, `uid`, `imglink`, `sex` FROM `fun_gallery` WHERE `sex`='M' ORDER BY `id` DESC LIMIT $limit_start, $items_per_page"));
else if($action=="male")
{
  addonline(getuid_sid($sid),"Male gallery","");
  
  echo "

";
$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_gallery WHERE sex='M' "));

    if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $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;

$q=mysql_query("SELECT `id`, `uid`, `imglink`, `sex` FROM `fun_gallery` WHERE `sex`='M' ORDER BY `id` DESC LIMIT $limit_start, $items_per_page");
$num_rows = mysql_num_rows($q); 
if ($num_rows==0) echo 'Male User Gallery is empty
';
while($getgalusers = mysql_fetch_array($q)){
$user = getnick_uid($getgalusers[1]);
$who = $getgalusers[1];
$link = "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$user</a>
";    
echo $link;
}
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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 "
";
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>";
    

}

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

wizard Senior · 493 posts #8

Everything looks fine, please post the sql table or just row names of your table, possible that the row names dont match.

$getgalusers = mysql_fetch_array(mysql_query("SELECT id, uid, imglink, sex FROM fun_gallery WHERE sex='M' ORDER BY uid LIMIT $limit_start, $items_per_page"));

add after order by uid the way how do you want to order desc for descending and asc for ascending

i think i have found the bug, here is the code which schould work. i havnt tested it.

$getgalusers = mysql_fetch_array(mysql_query("SELECT `id`, `uid`, `imglink`, `sex` FROM `fun_gallery` WHERE `sex`='M' ORDER BY `id` DESC LIMIT $limit_start, $items_per_page"));
else if($action=="male")
{
  addonline(getuid_sid($sid),"Male gallery","");
  
  echo "

";
$countusers = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_gallery WHERE sex='M' "));

    if($page=="" || $page<=0)$page=1;

    $num_items = $countusers[0];
    $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;
$q=mysql_query("SELECT `id`, `uid`, `imglink`, `sex` FROM `fun_gallery` WHERE `sex`='M' ORDER BY `id` DESC LIMIT $limit_start, $items_per_page");
$num_rows = mysql_num_rows($q); 
if ($num_rows==0) echo 'Male User Gallery is empty
';
while($getgalusers = mysql_fetch_array($q)){
$user = getnick_uid($getgalusers[1]);
$who = $getgalusers[1];
$link = "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$user</a>
";    
echo $link;
}
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>";
    }
    if($num_pages>1)
    {
    echo "
$page/$num_pages
";
    }
    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 "
";
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>";
    

}

k thanks. ill try it later

wizard Senior · 493 posts #9

i have a problem with this section of the coding.

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(*) FROM fun_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 id, uid FROM fun_gallery WHERE sex='M' ORDER BY uid DESC LIMIT $limit_start, $items_per_page";

 echo "

[size="1"]";
    $items = mysql_query($sql);
    echo mysql_error();
    
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
$who = $item[1];
$user=getnick_uid($who);

        $lnk = "<a href=\"gallery.php?action=viewuser&who=$who&sid=$sid\">$user</a>
";
       echo "$lnk"; 
    }
    }else{
echo "female gallery is empty";
}

    echo "[/size]</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 "
$page/$num_pages
";
    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>
";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    

}

it shows the male users like michael michael michael but i want it to show each user only once. can someone help me please.......... check my site http://funmobile.ws if you dont understand

Guest #11

its not displaying d image of the user

wizard Senior · 493 posts #12

its not displaying d image of the user

yes it is lol. just click on the username n u'll see all their photos. im adding photo comment feature but its giving me a hard time....... must b cuz im sleepy lol

wizard Senior · 493 posts #13

where did i go wrong here?

else if($action=="comments")
{

      $who = $_GET["who"];
$gid = $_GET["gid"];

    addonline(getuid_sid($sid),"Viewing Photos Comments","");
    //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    if($gid!="")
    {
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_galcomments WHERE pid='".$gid."'"));
    }else{
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_galcomments WHERE pid='".$gid."'"));
    }
    $num_items = $noi[0]; //changable
    $items_per_page= 10;
    $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($gid!="")
    {
        $sql = "SELECT id, pid, text, byuser, time FROM fun_galcomments WHERE pid='".$gid."' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
        }else{
$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))
    {
      $by = $items[3];
$byuser=$getnick_uid($by);
$link="<a href=\"index.php?action=viewuser&sid=$sid&who=$by\">$byuser</a>:";
$text=$items[2];
$time=$items[4];
        
      
      echo "$link $text
$time
";
      
    }
    }
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=\"lists.php?action=$action&page=$npage&sid=$sid&who=$who&gid=$gid\">Next»</a>";
    }
    echo "
$page/$num_pages
";
    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=\"who\" value=\"$who\"/>";
        $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
      $rets .= "<input type=\"hidden\" name=\"gid\" value=\"$gid\"/>";
        
        $rets .= "</form>";

        echo $rets;
    }

    //echo "<a href=\"gallery.php?action=viewuser&sid=$sid&who=$who\">$whonick Photo Gallery</a>
";

    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "Home</a>";
    echo "</p>";
    

}

i get this error

Fatal error: Function name must be a string in /home/funmobil/public_html/gallery.php on line 381

on this line

$byuser=$getnick_uid($by);
wizard Senior · 493 posts #15

user gallery now updated with photo comments, use as avatar button for photo owner, download photo, rate photo, owners or moderator/admin can delete photo n much more

subzero Super moderator Fellow · 3,954 posts #16

oh i did the same bro lol i made one too lol bro you goto make it to lock out out siders lol when user is sit on then clicks the gallery it says you not login

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #18

login to grim-reaper.ws External image (may be gone) bro you need to be a member

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #20

yours is too bro External image (may be gone) also its good to have it lock in to members only External image (may be gone)

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

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