Comment Gallery Does Not Work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Comment Gallery Does Not Work

    Gallery work, comments are entered in the database but is not shown in the list of comments ... why?

    gallery.php

    Code:
    <?php
    
    
    include("config.php");
    include("core.php");
    
    header("Content-type: text/vnd.wap.wml");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    echo("<?xml version=\"1.0\"?>");
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    
    ?>
    
    <wml>
    
    
    <?php
    
    $bcon = connectdb();
    if (!$bcon)
    {
        echo "<card id=\"main\" title=\"HAPPY-(GRESKA!)\">";
        echo "<p align=\"center\">";
        echo "<img src=\"http://coding-talk.com/images/exit.gif\" alt=\"*\"/>
    ";
        echo "GRESKA! Izgubljena konekcija sa SQL bazom
    
    ";
        echo "Ova greska se javlja kada se izvode radovi na portalu. Imajte strpljenja, forum ce uskoro biti dostupan.
    
    ";
        echo "Hvala na strpljenu.";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        exit();
    }
    $brws = explode(" ",$_SERVER["HTTP_USER_AGENT"]);
    $ubr = $brws[0];
    $uip = getip();
    $action = $_GET["action"];
    $sid = $_GET["sid"];
    $page = $_GET["page"];
    $who = $_GET["who"];
    $text = $_GET["text"];
    
    $uid = getuid_sid($sid);
    
    cleardata();
    if(isipbanned($uip,$ubr))
        {
          if(!isshield(getuid_sid($sid)))
          {
            echo "<card id=\"main\" title=\"HAPPY\">";
          echo "<p align=\"center\">";
          echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"x\"/>
    ";
          echo "Vasa IP adresa je banovana!
    ";
          echo "
    ";
          $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
    
    ";
          
          echo "</p>";
          echo "
    
    ";
      echo "Nick: <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/>
    ";
      echo "Lozinka: <input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/>
    ";
      echo "<anchor>Uloguj Se!<go href=\"login.php\" method=\"get\">";
      echo "<postfield name=\"loguid\" value=\"$(loguid)\"/>";
      echo "<postfield name=\"logpwd\" value=\"$(logpwd)\"/>";
      echo "</go></anchor>";
      echo "</p>";
          echo "</card>";
          echo "</wml>";
          exit();
          }
        }
    if(($action != "") && ($action!="terms"))
    {
        $uid = getuid_sid($sid);
        if((islogged($sid)==false)||($uid==0))
        {
            echo "<card id=\"main\" title=\"HAPPY\">";
          echo "<p align=\"center\">";
          echo "Vi niste logovani
    ";
          echo "ili Vam je istekao period sesije
    
    ";
          echo "<a href=\"index.php\">Uloguj Se!</a>";
          echo "</p>";
          echo "</card>";
          echo "</wml>";
          exit();
        }
        
        
        
    }
    //echo isbanned($uid);
    if(isbanned($uid))
        {
          echo "<card id=\"main\" title=\"HAPPY\">";
          echo "<p align=\"center\">";
          echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"x\"/>
    ";
          echo "Vi ste BANOVANI!
    ";
          $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
          $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
          
          $remain = $banto[0]- time();
          $rmsg = gettimemsg($remain);
          echo "Vreme do isteka bana: $rmsg
    
    ";
          echo "Razlog bana: $banres[0]";
          //echo "<a href=\"index.php\">Uloguj Se!</a>";
          echo "</p>";
          echo "</card>";
          echo "</wml>";
          exit();
        }
    $res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");
    
    ///////////////////////////////////// GALERIJA
    if($action=="main")
    {
    addonline(getuid_sid($sid),"U Galeriji Slika!","");
    echo "<card id=\"main\" title=\"HAPPY\">";
    echo "<p align=\"center\">";
    echo "SLIKE CLANOVA";
    echo "</p>";
    
    echo "
    
    ";
    $rnd = mysql_fetch_array(mysql_query("SELECT itemurl FROM ibwf_gallery ORDER BY RAND() LIMIT 1")); 
    echo "<img src=\"thumb.php?image=$rnd[0]\" alt=\"*\"/>
    ----------
    ";
    $males = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery WHERE sex='M'"));
    echo "<img src=\"http://coding-talk.com/images/male.gif\" alt=\"\"/> <a href=\"gallery.php?action=male&amp;sid=$sid\">Muski Clanovi</a> ($males[0])
    ";
    $females = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_gallery WHERE sex='F'"));
    echo "<img src=\"http://coding-talk.com/images/female.gif\" alt=\"\"/> <a href=\"gallery.php?action=female&amp;sid=$sid\">Zenski Clanovi</a> ($females[0])";
    echo "</p>";
    
    echo "<p align=\"center\">";
    echo "
    ----------
    ";
    echo "";
    echo "<a href=\"gallery.php?action=add&amp;sid=$sid\">Dodaj Sliku</a>
    ";
    //echo "<a href=\"addphoto.php?action=main&amp;sid=$sid\">Uploaduj Sliku</a>
    ";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "©HAPPY 2008";
    echo "";
    echo "</p>";
    echo "</card>";
    }
    else if($action=="add")
    {
    addonline(getuid_sid($sid),"Dodaje Sliku!","");
    echo "<card id=\"main\" title=\"HAPPY\">";
    echo "<p align=\"center\">";
    echo "Uploadujte samo licne fotografije i slike
    ";
    echo "Dozvoljeni formati .JPG/.JPEG/.GIF/.PNG !!!
    ";
    echo "Max. velicina slike 128x128 px !!!
    ";
    echo "Nick:
    <input name=\"user\" type=\"text\"/>
    ";
    echo "URL Slike:
    <input name=\"itemurl\" type=\"text\" value=\"http://\"/>
    ";
    echo "<anchor>Dodaj Sliku<go href=\"gallery.php?action=addgal&amp;sid=$sid\" method=\"post\">";
    echo "<postfield name=\"user\" value=\"$(user)\"/>";
    echo "<postfield name=\"itemurl\" value=\"$(itemurl)\"/>";
    echo "</go></anchor>";
    
    echo "
    ----------
    ";
    echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
    echo "</p>";
    echo "</card>";
    }
    else if($action=="male")
    {
        addonline(getuid_sid($sid),"Muski Clanovi!","");
        echo "<card id=\"main\" title=\"HAPPY\">";
        echo "
    
    ";
        $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";
    
        $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&amp;who=$who&amp;sid=$sid\">$user</a> ($countpics[0])
    ";
           echo "$lnk"; 
        }
        }
    
        echo "</p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          $prev = "<a href=\"gallery.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">«</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          $next = "<a href=\"gallery.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">»</a>";
        }
        echo "
    $prev $page/$num_pages $next";
    
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
        echo "</p>";
        echo "</card>";
    }
    else if($action=="female")
    {
        addonline(getuid_sid($sid),"Zenski Clanovi!","");
        echo "<card id=\"main\" title=\"HAPPY\">";
        echo "
    
    ";
        $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";
    
        $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&amp;who=$who&amp;sid=$sid\">$user</a> ($countpics[0])
    ";
            
    echo "$lnk";
    
        }
        }else{
    echo "Zenska galerija je prazna";
    }
        echo "</p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          $prev = "<a href=\"gallery.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">«</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          $next = "<a href=\"gallery.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">»</a>";
        }
        echo "
    $prev $page/$num_pages $next";
    
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
        echo "</p>";
        echo "</card>";
    }
    else if($action=="viewuser")
    {
        $who = $_GET["who"];
        $gall = $_GET["gall"];
        $rinfo = $_GET["rinfo"];
        addonline(getuid_sid($sid),"Slike Clanova!","");
        echo "<card id=\"main\" title=\"HAPPY\">";
        echo "<p align=\"center\">";
        $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";
            }
    
        $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\"/>
    ";
        $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 = "Rejting: $ther/$rinfo[1]
    Glasova: ($counts[0])
    ";
    }else{
    $rating = "";
    }
    $me = getuid_sid($sid);
    if($who=="$me") {
             $gall = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_galcomments WHERE pid='".$id."'"));
    $use = "<a href=\"gallery.php?action=useav&amp;sid=$sid&amp;gid=$item[0]\">Kao Avatar</a>";
    }else{
    $use = "";
    }
             $gall = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_galcomments WHERE pid='".$id."'"));
    $download = "<a href=\"$img\">Download</a>";
    $comments = "<a href=\"gallery.php?who=$who&amp;action=comments&amp;sid=$sid&amp;gid=$item[0]\">Komentara</a>($gall[0])";
          echo "$lnk
    $rating $download
    $use
    $comments
    ";
          
        }
        }
    
        echo "
    ";
        if($page>1)
        {
          $ppage = $page-1;
          $prev = "<a href=\"gallery.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">«</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          $next = "<a href=\"gallery.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">»</a>";
        }
        echo "
    $prev $page/$num_pages $next";
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
        echo "</p>";
        echo "</card>";
    }
    else if($action=="comments")
    {
        $who = $_GET["who"];
        $gid = $_GET["gid"];
        $text = $_GET["text"];
        addonline(getuid_sid($sid),"Gleda Komentare!","");
        echo "<card id=\"main\" title=\"HAPPY\">";
        $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 "
    
    ";
        $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 = "$iml <a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$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=\"gallery.php?action=delcmt&amp;sid=$sid&amp;id=$item[0]\">[obrisi]</a>";
          }else{
            $delnk = "";
          }
          $text = parsepm($item[2], $sid);
          echo "$text
    $delnk
    ";
          echo "$bs";
          echo "
    ";
    
        }
        }
        echo "</p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          $prev = "<a href=\"gallery.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">«</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          $next = "<a href=\"gallery.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">»</a>";
        }
        echo "
    $prev $page/$num_pages $next
    ";
    
        echo "</p>";
      ////// UNTILL HERE >>
        echo "<p align=\"center\">";
       $me = getuid_sid($sid);
    if($me!="$who") {
      echo "<a href=\"gallery.php?action=addcomment&amp;sid=$sid&amp;who=$who&amp;gid=$gid\">Daj Komentar</a>";
    }
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
      echo "</p>";
      echo "</card>";
    }
    else if($action=="addcomment")
    {
        $who = $_GET["who"];
        $gid = $_GET["gid"];
        $pid = $_GET["pid"];
        $text = $_POST["text"];
        addonline(getuid_sid($sid),"Ostavlja Komentar!","");
        echo "<card id=\"main\" title=\"HAPPY\">";
        echo "<p align=\"center\">";
        $uid = getuid_sid($sid);
        $sql = "SELECT itemurl FROM ibwf_gallery  WHERE id='".$gid."'";
        $items = mysql_query($sql);
        echo mysql_error();
        if(mysql_num_rows($items)>0)
        {
        while ($item = mysql_fetch_array($items))
        {
          
        $img = $item[2];
        
          $lnk = "<img src=\"$img\" alt=\"$id\"/>
    ";
            
          echo "$lnk";
    
    
    echo "Komentar:
    ";
    echo "<input type=\"text\" maxlength=\"150\" name=\"text\"/>
    ";
    echo "<anchor>Potvrdi<go href=\"gallery.php?action=commentadd&amp;sid=$sid\" method=\"post\">";
    echo "<postfield name=\"text\" value=\"$(text)\"/>";
    echo "<postfield name=\"prate\" value=\"$(prate)\"/>";
    echo "</go></anchor>";
        }
        }
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>";
      echo "</p>";
      echo "</card>";
    }else if($action=="useav")
    {
      $gid = $_GET["gid"];
      addonline(getuid_sid($sid),"Postavlja Avatar!","");
      echo "<card id=\"main\" title=\"HAPPY\">";
      echo "<p align=\"center\">";
    $getimg = mysql_fetch_array(mysql_query("SELECT itemurl FROM ibwf_gallery WHERE id='".$gid."'"));
    
    $avatar = $getimg[0];
      $uid = getuid_sid($sid);
    
        $res = mysql_query("Update ibwf_users SET avatar='".$avatar."' WHERE id='".$uid."'");
        if($res)
            {
                echo "SLIKA POSTAVLJENA KAO AVATAR !!!
    ";
            }else{
              echo "GRESKA BAZE PODATAKA !!!
    ";
            }
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
      echo "</p>";
      echo "</card>";
    }
    
    else if($action=="delgal")
    {
      $gid = $_GET["gid"];
      addonline(getuid_sid($sid),"Brise Sliku!","");
      echo "<card id=\"main\" title=\"HAPPY\">";
      echo "<p align=\"center\">";
      $itemowner = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_gallery WHERE id='".$gid."'"));
      if(ismod(getuid_sid($sid))||getuid_sid($sid)==$itemowner[0])
      {
        $res = mysql_query("DELETE FROM ibwf_gallery WHERE id='".$gid."'");
    $res2 = mysql_query("DELETE FROM ibwf_galcomments WHERE pid='".$gid."'");
    $res3 = mysql_query("DELETE FROM ibwf_prate WHERE pid='".$gid."'");
        if($res||res2||res3)
            {
                echo "SLIKA USPESNO OBRISANA !!!
    ";
            }else{
              echo "GRESKA BAZE PODATAKA !!!
    ";
            }
      }else{
        echo "NE MOZETE OBRISATI SLIKU !!!
    ";
      }
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
      echo "</p>";
      echo "</card>";
    }
    else if($action=="commentadd")
    {
          $text = $_POST["text"];
          $who = $_GET["who"];
          $gid = $_GET["gid"];
          $pid = $_GET["pid"];
          addonline(getuid_sid($sid),"Ostavlja Komentar!","");
          echo "<card id=\"main\" title=\"HAPPY\">";
          echo "<p align=\"center\">";
          $crdate = time();
          $uid = getuid_sid($sid);
          $res = false;
    
          if(trim($text)!="")
          {
            
          $res = mysql_query("INSERT INTO ibwf_galcomments SET text='".$text."', byuser='".$uid."', time='".$crdate."', pid='".$gid."'");
          }
          if($res)
          {
            echo "KOMENTAR USPESNO DODAT !!!
    ";
          }else{
            echo "GRESKA BAZE PODATAKA !!!
    ";
        }
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
          echo "</p>";
    echo "</card>";
    }else if($action=="delcmt")
    {
      $id = $_GET["id"];
      addonline(getuid_sid($sid),"Brise Komentar!","");
      echo "<card id=\"main\" title=\"HAPPY\">";
      echo "<p align=\"center\">";
    
      $res = mysql_query("DELETE FROM ibwf_galcomments WHERE id ='".$id."'");
      if($res)
              {
              mysql_query("INSERT INTO ibwf_mlog SET action='comment', details='".getnick_uid(getuid_sid($sid))." Obrisao komentar', actdt='".time()."'");
                echo "KOMENTAR USPESNO OBRISAN !!!
    ";
              }else{
                echo "GRESKA BAZE PODATAKA !!!
    ";
              }
    
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
      echo "</p>";
      echo "</card>";
    }else if($action=="addgal")
    {
       $user = $_POST["user"];
       $itemurl = $_POST["itemurl"];
      addonline(getuid_sid($sid),"Dodaje Sliku!","");
       echo "<card id=\"main\" title=\"HAPPY\">";
       $uid = getuid_nick($user);
       $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";
      }
    
          echo "<p align=\"center\">";
          $res = mysql_query("INSERT INTO ibwf_gallery SET uid='".$uid."', itemurl='".$itemurl."', sex='".$usex."'");
          if($res)
          {
            echo "SLIKA USPESNO DODATA !!!
    ";
          }else{
            echo "GRESKA BAZE PODATAKA !!!
    ";
          }
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
      echo "</p>";
      echo "</card>";
    }else{
      addonline(getuid_sid($sid),"Izgubljeni u Galeriji!","");
      echo "<card id=\"main\" title=\"HAPPY\">";
      echo "<p align=\"center\">";
      echo "NE ZNAM STA TRAZIS OVDE ???";
      echo "
    ----------
    ";
      echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Galerija Slika</a>
    ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>
    ";
    echo "© HAPPY 2008";
    echo "";
      echo "</p>";
      echo "</card>";
    }
    
    ?>
    </wml>


    Sql
    Code:
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `ibwf_galcomments`
    --
    
    CREATE TABLE IF NOT EXISTS `ibwf_galcomments` (
      `id` int(99) NOT NULL auto_increment,
      `pid` int(99) NOT NULL default '0',
      `text` varchar(200) NOT NULL default '',
      `byuser` varchar(100) NOT NULL default '',
      `time` varchar(99) NOT NULL default '',
      PRIMARY KEY  (`id`),
      UNIQUE KEY `text` (`text`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
    
    --
    -- Dumping data for table `ibwf_galcomments`
    --
    
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `ibwf_gallery`
    --
    
    CREATE TABLE IF NOT EXISTS `ibwf_gallery` (
      `id` int(100) NOT NULL auto_increment,
      `uid` int(100) NOT NULL default '0',
      `sex` varchar(255) NOT NULL default '',
      `itemurl` varchar(255) NOT NULL default '',
      `views` int(100) NOT NULL default '1',
      `comentariu` varchar(100) NOT NULL default '',
      `data` int(100) NOT NULL default '0',
      `raport` char(1) NOT NULL default '0',
      `marime` varchar(100) NOT NULL default 'negasit',
      `adaugat` varchar(100) NOT NULL default '',
      PRIMARY KEY  (`id`),
      UNIQUE KEY `name` (`itemurl`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
    
    --
    -- Dumping data for table `ibwf_gallery`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `ibwf_prate`
    --
    
    CREATE TABLE IF NOT EXISTS `ibwf_prate` (
      `id` int(100) NOT NULL auto_increment,
      `pid` int(100) NOT NULL default '0',
      `uid` int(100) NOT NULL default '0',
      `prate` char(2) NOT NULL default '',
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
    
    --
    -- Dumping data for table `ibwf_prate`
    --
    sigpichttp://happy.srecnica.com/web
Working...
X