users delete there own pics

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

3 replies · 370 views · started 16 years ago · 1 min read

3 participants
nclemale36 Lead · 537 posts #1

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

////////////////////////////////////////////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 .

if(candelpic($item[0]))
        {
        echo " / <a href=\"usergallery.php?action=del&sid=$sid&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

Mysterio Lead · 630 posts #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

thunderwap Developer · 169 posts #3

nclemale36 wrote: 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

////////////////////////////////////////////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 .

if(candelpic($item[0]))
        {
        echo " / <a href=\"usergallery.php?action=del&sid=$sid&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

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

instead

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

try that

post ur sql so i can see core

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

nclemale36 Lead · 537 posts #4

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

here the code

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

users can only see the delete X on there own pics . easy lol cheers anyway

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