private profile for lavalair

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

    private profile for lavalair

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

    PHP Code:
    $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&amp;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&amp;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...

    Last edited by hypetype; 20.05.09, 18:41. Reason: errors

    #2
    the coding that is giving me problem is this
    PHP Code:
    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
    Last edited by hypetype; 20.05.09, 18:48. Reason: put more info instead of making a new reply

    Comment


      #3
      missing a ) on the end

      Comment


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

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

        Comment


          #5
          use ismod(getuid_sid($sid))

          Comment


            #6
            not workin

            Comment


              #7
              try this it will work fine just edit your tables name

              PHP Code:
              $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...";


              PHP Code:
              <?

              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];
              }

              ?>
              Last edited by Anshul; 21.05.09, 18:35.

              Comment


                #8
                Originally posted by Anshul View Post
                try this it will work fine just edit your tables name

                PHP Code:
                $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...";


                PHP Code:
                <?

                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,

                Comment


                  #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

                  PHP Code:
                  else if($action=="viewuser")

                  {

                    
                  addonline(getuid_sid($sid),"Viewing Users Profile","index.php?action=viewuser&amp;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/>"
                  Last edited by Anshul; 22.05.09, 16:00.

                  Comment


                    #10
                    anshul bro can you code it for me ?

                    Comment


                      #11
                      how about private gallery?

                      Comment


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

                        Comment


                          #13
                          Try changing & to OR

                          Comment


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

                            Comment


                              #15
                              to set the user chooses the option on / off for this code? ... when it is off to this code works. when he is to see the profile of all ..
                              sigpichttp://happy.srecnica.com/web

                              Comment

                              Working...
                              X