users delete there own pics

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

    users delete there own pics

    hi aint been around for a while .been working hard . so am getting back into things and want be able to let my users delete there own pics from gallery .

    created a function in my core but cant get it to work . .
    just need a few pointers

    Code:
    ////////////////////////////////////////////delete own pic
    
    function candelpic($uid,$mid)
    {
      $minfo = mysql_fetch_array(mysql_query("SELECT imageurl FROM ibwf_usergallery WHERE id='".$mid."'"));
      if($minfo[0]==$uid)
      {
        return true;
      }
      if($minfo[1]==$uid)
      {
        return true;
      }
      return false;
    }
    using this in the usergallery so only the user can see the delete X cross which dont work either lol .
    Code:
    if(candelpic($item[0]))
            {
            echo " / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>";
            }
    prob be easier to add a line of code that lets the user see the delete cross on his/her pics only but my brain fried with working 70 hours a week lol

    please help . ta
    Wapchat4u


    Topsites4u

    #2
    code 1. $minfo[0] is the imageurl, it can not equal to $uid. You need to work with photo-userid. Something like "SELECT imageurl, author FROM ibwf_usergallery WHERE id='".$mid."'". Then try
    if ($minfo[1] == "".$uid."")
    { return true }

    code 2. i think it should be
    if (candelpic($uid,$mid))

    hope i helped you.
    mysterio.al - programming is a functional art

    Comment


      #3
      Originally posted by nclemale36 View Post
      hi aint been around for a while .been working hard . so am getting back into things and want be able to let my users delete there own pics from gallery .

      created a function in my core but cant get it to work . .
      just need a few pointers

      Code:
      ////////////////////////////////////////////delete own pic
      
      function candelpic($uid,$mid)
      {
        $minfo = mysql_fetch_array(mysql_query("SELECT imageurl FROM ibwf_usergallery WHERE id='".$mid."'"));
        if($minfo[0]==$uid)
        {
          return true;
        }
        if($minfo[1]==$uid)
        {
          return true;
        }
        return false;
      }
      using this in the usergallery so only the user can see the delete X cross which dont work either lol .
      Code:
      if(candelpic($item[0]))
              {
              echo " / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>";
              }
      prob be easier to add a line of code that lets the user see the delete cross on his/her pics only but my brain fried with working 70 hours a week lol

      please help . ta
      it should be


      Code:
      if(candelpic($uid, $item[0]))
              {
              echo " / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>";
              }

      instead

      Code:
      if(candelpic($item[0]))
              {
              echo " / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>";
              }

      try that

      post ur sql so i can see core
      Last edited by thunderwap; 31.12.09, 17:57.
      sigpic

      WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

      Comment


        #4
        lol easier than i thought. didnt even have to make a new function ,.

        here the code
        Code:
        if($uid1==$item[0])
                {
                echo " / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>";
                }
        users can only see the delete X on there own pics . easy lol cheers anyway
        Wapchat4u


        Topsites4u

        Comment

        Working...
        X