private profile for lavalair

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

17 replies · 2,308 views · started 17 years ago · 1 min read

TL;DR · summary of 17 replies
  • normal users can view there profile but not the staff, staff cant view there profile either, buds cant view there buddies profile,
  • use ismod(getuid_sid($sid)) for checking if user is admin or mod.
  • Try changing & to OR as suggested by syrus.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

9 participants
hypetype Developer · 128 posts #1

i am trying to code this private profile thing for my site but got a few problems

$private = mysql_fetch_array(mysql_query("SELECT private FROM htp_users WHERE id='".$who."'"));
  if($private[0]=='1')
  {
$unick = getnick_uid($who);
  addonline(getuid_sid($sid),"Viewing $unick Profile","<a href=\"index.php?action=viewuser&who=$who\">go there</a>");
    echo "<card id=\"main\" title=\"$unick's Profile\">";
      echo "<p align=\"center\">";
      echo "<u>$unick Profile is private</u><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
echo "Home</a><br/>";
      echo "</p>";
      echo "</card>";
}else if(budres($uid, $who)==2||ismod($uid)||mypro(getuid_sid($sid), $who)
{
then u can view the profile...
}
hypetype Developer · 128 posts #2

the coding that is giving me problem is this

else if(budres($uid, $who)==2||ismod($uid)||mypro(getuid_sid($sid), $who)

i want admins and mods to view profiles, buddies can view and also the user of the profile

but whenever i use that code the profile is still saying its private. can u hlp me plz

hypetype Developer · 128 posts #4

nope still saying profile private. even though am admin and try to view my own profile it still says private

else if(budres($uid, $who)==2||ismod($uid)||mypro(getuid_sid($sid), $who)
Anshul Senior · 296 posts #7

try this it will work fine just edit your tables name 🙂

$private = mysql_fetch_row(mysql_query("SELECT private FROM htp_users WHERE id='".$who."'"));
if(($private[0]=='1') && (budres(getuid_sid($sid), $who)!=2)  && (!ismod(getuid_sid($sid))) && (getuid_sid($sid)!=$who))
{
$unick = getnick_uid($who);
echo "<u>$unick Profile is private</u><br/>";
}else 
{
echo"then u can view the profile...";
}
<?

function ismod($uid)
{
  $perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
  
  if($perm[0]>0)
  {
    return true;
  }
}

function getuid_sid($sid)
{
  $uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
  $uid = $uid[0];
  return $uid;
}

function budres($uid, $tid)
{
  //3 = can't bud
  //2 = already buds
  //1 = request pended
  //0 = can bud
  if($uid==$tid)
  {
    return 3;
  }
  
  if (arebuds($uid, $tid))
  {
    return 2;
  }
  $req = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='0'"));
  if($req[0]>0)
  {
    return 1;
  }
  $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$tid."' OR tid='".$tid."') AND agreed='1'"));
  global $max_buds;
  if($notb[0]>=$max_buds)
  {
    
    return 3;
  }
  $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'"));
  global $max_buds;
  if($notb[0]>=$max_buds)
  {

    return 3;
  }
  return 0;
}

function getnick_uid($uid)
{
  $unick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
  return $unick[0];
}

?>
hypetype Developer · 128 posts #8

Anshul wrote: try this it will work fine just edit your tables name 🙂

$private = mysql_fetch_row(mysql_query("SELECT private FROM htp_users WHERE id='".$who."'"));
if(($private[0]=='1') && (budres(getuid_sid($sid), $who)!=2)  && (!ismod(getuid_sid($sid))) && (getuid_sid($sid)!=$who))
{
$unick = getnick_uid($who);
echo "<u>$unick Profile is private</u><br/>";
}else 
{
echo"then u can view the profile...";
}
<?

function ismod($uid)
{
  $perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
  
  if($perm[0]>0)
  {
    return true;
  }
}


function getuid_sid($sid)
{
  $uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
  $uid = $uid[0];
  return $uid;
}


function budres($uid, $tid)
{
  //3 = can't bud
  //2 = already buds
  //1 = request pended
  //0 = can bud
  if($uid==$tid)
  {
    return 3;
  }
  
  if (arebuds($uid, $tid))
  {
    return 2;
  }
  $req = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE ((uid='".$uid."' AND tid='".$tid."') OR (uid='".$tid."' AND tid='".$uid."')) AND agreed='0'"));
  if($req[0]>0)
  {
    return 1;
  }
  $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$tid."' OR tid='".$tid."') AND agreed='1'"));
  global $max_buds;
  if($notb[0]>=$max_buds)
  {
    
    return 3;
  }
  $notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$uid."' OR tid='".$uid."') AND agreed='1'"));
  global $max_buds;
  if($notb[0]>=$max_buds)
  {

    return 3;
  }
  return 0;
}


function getnick_uid($uid)
{
  $unick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
  return $unick[0];
}

?>

hmmm damn, its not work the way i want.

normal users can view there profile but not the staff, staff cant view there profile either, buds cant view there buddies profile,

Anshul Senior · 296 posts #9

It will work fine i tested the code wid lava if u had put the ryt tables names.

if private == 1 then only buddies can view profiles staff can view profile self can view profile

otherwise all

else if($action=="viewuser")

{

  addonline(getuid_sid($sid),"Viewing Users Profile","index.php?action=viewuser&who=$who");

    echo "<card id=\"main\" title=\"lavalair.net\">";

  echo "<p align=\"center\">";

  if($who==""||$who==0)

  {

    $mnick = $_POST["mnick"];

    $who = getuid_nick($mnick);

  }

  $whonick = getnick_uid($who);

  if($whonick!="")

  {
$private = mysql_fetch_row(mysql_query("SELECT private FROM htp_users WHERE id='".$who."'"));
if(($private[0]=='1') && (budres(getuid_sid($sid), $who)!=2)  && (!ismod(getuid_sid($sid))) && (getuid_sid($sid)!=$who))
{
$unick = getnick_uid($who);
echo "<u>$unick Profile is private</u><br/>";
}else 
{
echo"then u can view the profile...";
}  
echo "$whonick's Profile<br/>";
bijaybd Developer · 178 posts #10

anshul bro can you code it for me ?

bijaybd Developer · 178 posts #12

i tried to code it but i am failed can someone help me :((

syrus Junior · 44 posts #13

Try changing & to OR

bijaybd Developer · 178 posts #14

i tried a lot still doesn't works for me can somebody help me i can provide my details

newbie14 Junior · 22 posts #17

re

hmm..any1 post it here the complete code and sql only their buddies and staff can view the private profile?

Write your reply now; next you create a free account (or sign in) and it is posted right away. 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