Any One Know This

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

    Any One Know This

    hi does any know how to make ghost mode so when users are ghosting staff can see who is in ghost mode
    heres the 2 codes i think will help

    $sql="
    SELECT a.name, a.sex, a.level, b.place, b.userid,
    a.onmood, a.ghost FROM members a INNER JOIN ibwf_online
    b ON a.id = b.userid WHERE ghost='0' GROUP BY 1,2 LIMIT
    $limit_start, $items_per_page";


    //////////////////////Function add user to online list :P
    function addonline($uid,$place,$plclink){
    $ttime=time();
    $ghost=mysql_fetch_array(mysql_query("SELECT ghost FROM members WHERE id='".$uid."'"));
    if($ghost[0]=="0"){
    $tm = time();
    $timeout = $tm - 420;
    $deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <&#39;".$timeout."&#39;");
    $res = mysql_query("UPDATE members SET lastact=&#39;" . $ttime . "&#39; WHERE id=&#39;" . $uid . "&#39;");
    $res = mysql_query("INSERT INTO ibwf_online SET userid=&#39;" . $uid . "&#39;, actvtime=&#39;" . $ttime . "&#39;, place=&#39;" . $place . "&#39;, placedet=&#39;" . $plclink . "&#39;");
    if(!$res){
    $res=mysql_query("UPDATE ibwf_online SET actvtime=&#39;".$tm."&#39;, place=&#39;".$place."&#39;, placedet=&#39;".$plclink."&#39; WHERE userid=&#39;".$uid."&#39;");}}
    $maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id=&#39;2&#39;"));
    $result=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
    if($result[0]>=$maxmem[0]){
    $tnow=date("D d M Y - H:i");
    mysql_query("UPDATE ibwf_settings set name=&#39;".$tnow."&#39;, value=&#39;".$result[0]."&#39; WHERE id=&#39;2&#39;");}
    $maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt=&#39;".date("d m y")."&#39;"));
    if($maxtoday[0]==0||$maxtoday==""){
    mysql_query("INSERT INTO ibwf_mpot SET ddt=&#39;".date("d m y")."&#39;, ppl=&#39;1&#39;, dtm=&#39;".date("H:i:s")."&#39;");
    $maxtoday[0]=1;}
    if($result[0]>=$maxtoday[0]){
    mysql_query("UPDATE ibwf_mpot SET ppl=&#39;".$result[0]."&#39;, dtm=&#39;".date("H:i:s")."&#39; WHERE ddt=&#39;".date("d m y")."&#39;");}
    }

    #2
    tut tut chris. if you search ya will find it!

    Comment


      #3
      ghost mode is in here but the code for staff to view members when on ghost mode is not

      Comment


        #4
        Nobody can view ghosted members / admins with that code as when you enter ghost mode you are taken off the online list... the only way you can do it using that code is by the sid&#39;s but you will need to code a new online list just for admins to view unless you can edit the original online list and are able to get the ID from the sid and then only show it to admins... thats the only way i can think of at the minite, when i have time i&#39;ll have a look at the properly and let you know.

        Comment


          #5
          pretty simple really .. in that code which updates users online you have this
          Code:
          if($ghost[0]=="0"){
          
           $tm = time();
           $timeout = $tm - 420;
           $deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <&#39;".$timeout."&#39;");
           $res = mysql_query("UPDATE members SET lastact=&#39;" . $ttime . "&#39; WHERE id=&#39;" . $uid . "&#39;");
           $res = mysql_query("INSERT INTO ibwf_online SET userid=&#39;" . $uid . "&#39;, actvtime=&#39;" . $ttime . "&#39;, place=&#39;" . $place . "&#39;, placedet=&#39;" . $plclink . "&#39;");
           if(!$res){
            $res=mysql_query("UPDATE ibwf_online SET actvtime=&#39;".$tm."&#39;, place=&#39;".$place."&#39;, placedet=&#39;".$plclink."&#39; WHERE userid=&#39;".$uid."&#39;");
            }
           }
          this only updates the user online if the user is not in ghost mode .. scrap it .. remove the IF statement and update it all the time .

          now go to your online list and find the query that checks users online ... make sure that query selects the ghost status of each user it is going to display

          now in your online list code its simple a case of

          Code:
          if($ghost == 1 AND USER IS STAFF)
           {
            // Display the online stuff as normal (you may wanna put a G icon next to there name so u kno their ghosting)
            }
          elseif ($ghost == 1 AND USER IS NOT STAFF)
           {
           // do not show user
           }
          else
           {
            // show as normal as they are not ghosting
           }
          extremely simple code .. i could probably have coded it for you but ive never even looked at these wapdesire scripts and such for longer than 10 mins .. if you have a go and cant figure it out post the code for displaying your online users and an example of how to check if a user is a staff member and i&#39;ll do it for you .. but as i said its basic PHP coding

          Comment


            #6
            could you explain a bit more please i tryed what ya said n nothing m8 n thats drugsbunny

            Comment


              #7
              <div class='quotetop'>QUOTE (jsyguy23 @ Oct 30 2008, 10:21 PM) <{POST_SNAPBACK}></div>
              could you explain a bit more please i tryed what ya said n nothing m8 n thanks drugsbunny[/b]

              Comment


                #8
                ok post your code for displaying online users (dunno whether its a function or just a script on its own) .. and i&#39;ll see if i can do it for ya .. but as i said ive never touched this script so make sure you keep a backup of the original files just incase as im not setting up the script to test it .. i&#39;ll just code it off the fly and hope it works

                Comment


                  #9
                  Code:
                  //////////////////////Function add user to online list blum.gif
                  function addonline($uid,$place,$plclink){
                  $ttime=time();
                  $ghost=mysql_fetch_array(mysql_query("SELECT ghost FROM members WHERE id=&#39;".$uid."&#39;"));
                  if($ghost[0]=="0"){
                  $tm = time();
                  $timeout = $tm - 420;
                  $deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <&#39;".$timeout."&#39;");
                  $res = mysql_query("UPDATE members SET lastact=&#39;" . $ttime . "&#39; WHERE id=&#39;" . $uid . "&#39;");
                  $res = mysql_query("INSERT INTO ibwf_online SET userid=&#39;" . $uid . "&#39;, actvtime=&#39;" . $ttime . "&#39;, place=&#39;" . $place . "&#39;, placedet=&#39;" . $plclink . "&#39;");
                  if(!$res){
                  $res=mysql_query("UPDATE ibwf_online SET actvtime=&#39;".$tm."&#39;, place=&#39;".$place."&#39;, placedet=&#39;".$plclink."&#39; WHERE userid=&#39;".$uid."&#39;");}}
                  $maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id=&#39;2&#39;"));
                  $result=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
                  if($result[0]>=$maxmem[0]){
                  $tnow=date("D d M Y - H:i");
                  mysql_query("UPDATE ibwf_settings set name=&#39;".$tnow."&#39;, value=&#39;".$result[0]."&#39; WHERE id=&#39;2&#39;");}
                  $maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt=&#39;".date("d m y")."&#39;"));
                  if($maxtoday[0]==0||$maxtoday==""){
                  mysql_query("INSERT INTO ibwf_mpot SET ddt=&#39;".date("d m y")."&#39;, ppl=&#39;1&#39;, dtm=&#39;".date("H:i:s")."&#39;");
                  $maxtoday[0]=1;}
                  if($result[0]>=$maxtoday[0]){
                  mysql_query("UPDATE ibwf_mpot SET ppl=&#39;".$result[0]."&#39;, dtm=&#39;".date("H:i:s")."&#39; WHERE ddt=&#39;".date("d m y")."&#39;");}
                  }

                  Comment


                    #10
                    no thats the function that adds the user to the online list ... i need to see the function or script which then displays them. on one site i know of there online list is displayed by the script "online.php". Basically i need to see yours in order to edit it to show ghost users to staff.

                    additionally you also need to post how staff are identified within your script (if anyone else reads this and they think they have the same source as this guy and you understand what i mean by how staff are identified then please just post how its done)

                    as i said i dont use the script but the edits are very basic PHP edits. so if i have the bits of code i need i should be able to do it for ya

                    Comment


                      #11
                      else if($action=="online"){
                      addonline(getuid_sid($sid),"Online List","");
                      echo "<head>
                      <title>(".getnumonline().") :Online</title>
                      <link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">
                      </head>
                      <body>
                      <p align=\"center\">
                      <img src=\"../phpThumb/phpThumb.php?src=../image/online.gif\" alt=\"\"/>
                      ";
                      $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id=&#39;2&#39;"));
                      echo "Highest Online: $mols[1]
                      ";
                      $umsg = getunreadpm(getuid_sid($sid));
                      if($umsg>0)
                      echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a>
                      </p>";
                      echo popup($sid);
                      //////ALL LISTS SCRIPT <<

                      if($page=="" || $page<=0)$page=1;
                      $num_items = getnumonline(); //changable
                      $items_per_page= 10;
                      $num_pages = ceil($num_items/$items_per_page);
                      if($page>$num_pages)$page= $num_pages;
                      $limit_start = ($page-1)*$items_per_page;

                      $sql="
                      SELECT a.name, a.sex, a.level, b.place, b.userid,
                      a.onmood, a.ghost FROM members a INNER JOIN ibwf_online
                      b ON a.id = b.userid WHERE ghost=&#39;0&#39; GROUP BY 1,2 LIMIT
                      $limit_start, $items_per_page";

                      echo "<p align=\"left\">";
                      $items = mysql_query($sql);
                      echo mysql_error();
                      while ($item = mysql_fetch_array($items))
                      {
                      if($item[2]==&#39;0&#39;)
                      {
                      $tit = "*";
                      }if($item[2]==&#39;1&#39;)
                      {
                      $tit = "³";
                      }if($item[2]==&#39;2&#39;)
                      {
                      $tit = "¹";
                      } if($item[2]==&#39;3&#39;)
                      {
                      $tit = "ª";
                      } if($item[2]==&#39;4&#39;)
                      {
                      $tit = "º";
                      } if($item[2]==&#39;5&#39;)
                      {
                      $tit = "°";
                      }

                      $sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name=&#39;$item[0]&#39;"));
                      if($sex[0]=="M"){$usersex = "<img src=\"../phpThumb/phpThumb.php?src=../images/male.gif\" alt=\"(M)\"/>";}
                      if($sex[0]=="F"){$usersex = "<img src=\"../phpThumb/phpThumb.php?src=../images/female.gif\" alt=\"(F)\"/>";}
                      if($sex[0]==""){$usersex = "";}

                      $lnk = "$usersex <a href=\"users.php?action=viewuser&amp;who=$item[4]&amp;sid=$sid\">$tit$item[0]</a>";

                      echo "$lnk ~ $item[2]
                      ";}
                      echo "</p>

                      <p align=\"center\">";
                      if($page>1){$ppage = $page-1;
                      echo "<a href=\"main.php?action=online&amp;page=$ppage&amp; sid=$sid\">«Prev</a> ";}
                      if($page<$num_pages){$npage = $page+1;
                      echo "<a href=\"main.php?action=online&amp;page=$npage&amp; sid=$sid\">Next»</a>";}
                      echo "
                      $page/$num_pages";if($num_pages>2){echo getjumper($action, $sid,"main");}
                      echo "</p>";

                      //// UNTILL HERE >>
                      echo "<p align=\"center\">";
                      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
                      echo "<a accesskey=\"2\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a>

                      <a accesskey=\"5\" href=\"forums.php?action=forumindx&amp;sid=$sid\"> Forums</a>

                      <a accesskey=\"2\" href=\"main.php?action=onmood&amp;sid=$sid\">Chang e Mood</a>

                      <a accesskey=\"3\" href=\"chat1.php?action=chat&amp;sid=$sid\">ChatRo oms($chs[0])</a>

                      <a accesskey=\"4\" href=\"main.php?action=main&amp;sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"\"/>Main Menu</a>
                      </p>
                      </body>";
                      exit();}



                      this it my online.php for the staff bits is if(isowner(getuid_sid($sid))) if(isheadadmin(getuid_sid($sid))) if(ismod(getuid_sid($sid))) i think thats what ya need m8 its a wapdesire script lol

                      Comment


                        #12
                        Code:
                        //////////////////////Function add user to online list blum.gif
                        function addonline($uid,$place,$plclink){
                        $ttime=time();
                        $tm = time();
                        $timeout = $tm - 420;
                        $deloff = mysql_query("DELETE FROM ibwf_online WHERE actvtime <&#39;".$timeout."&#39;");
                        $res = mysql_query("UPDATE members SET lastact=&#39;" . $ttime . "&#39; WHERE id=&#39;" . $uid . "&#39;");
                        $res = mysql_query("INSERT INTO ibwf_online SET userid=&#39;" . $uid . "&#39;, actvtime=&#39;" . $ttime . "&#39;, place=&#39;" . $place . "&#39;, placedet=&#39;" . $plclink . "&#39;");
                        if(!$res){
                        $res=mysql_query("UPDATE ibwf_online SET actvtime=&#39;".$tm."&#39;, place=&#39;".$place."&#39;, placedet=&#39;".$plclink."&#39; WHERE userid=&#39;".$uid."&#39;");}
                        $maxmem=mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE id=&#39;2&#39;"));
                        $result=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_online"));
                        if($result[0]>=$maxmem[0]){
                        $tnow=date("D d M Y - H:i");
                        mysql_query("UPDATE ibwf_settings set name=&#39;".$tnow."&#39;, value=&#39;".$result[0]."&#39; WHERE id=&#39;2&#39;");}
                        $maxtoday = mysql_fetch_array(mysql_query("SELECT ppl FROM ibwf_mpot WHERE ddt=&#39;".date("d m y")."&#39;"));
                        if($maxtoday[0]==0||$maxtoday==""){
                        mysql_query("INSERT INTO ibwf_mpot SET ddt=&#39;".date("d m y")."&#39;, ppl=&#39;1&#39;, dtm=&#39;".date("H:i:s")."&#39;");
                        $maxtoday[0]=1;}
                        if($result[0]>=$maxtoday[0]){
                        mysql_query("UPDATE ibwf_mpot SET ppl=&#39;".$result[0]."&#39;, dtm=&#39;".date("H:i:s")."&#39; WHERE ddt=&#39;".date("d m y")."&#39;");}
                        }
                        <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
                        else if($action=="online"){
                        addonline(getuid_sid($sid),"Online List","");
                        echo "<head>
                        <title>(".getnumonline().") :Online</title>
                        <link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">
                        </head>
                        <body>
                        <p align=\"center\">
                        <img src=\"../phpThumb/phpThumb.php?src=../image/online.gif\" alt=\"\"/>
                        ";
                        $mols = mysql_fetch_array(mysql_query("SELECT name, value FROM ibwf_settings WHERE id=&#39;2&#39;"));
                        echo "Highest Online: $mols[1]
                        ";
                        $umsg = getunreadpm(getuid_sid($sid));
                        if($umsg>0)
                        echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">$umsg New Inbox!</a>
                        </p>";
                        echo popup($sid);
                        //////ALL LISTS SCRIPT <<

                        if($page=="" || $page<=0)$page=1;
                        $num_items = getnumonline(); //changable
                        $items_per_page= 10;
                        $num_pages = ceil($num_items/$items_per_page);
                        if($page>$num_pages)$page= $num_pages;
                        $limit_start = ($page-1)*$items_per_page;

                        $sql="
                        SELECT a.name, a.sex, a.level, b.place, b.userid,
                        a.onmood, a.ghost FROM members a INNER JOIN ibwf_online
                        b ON a.id = b.userid GROUP BY 1,2 LIMIT
                        $limit_start, $items_per_page";

                        echo "<p align=\"left\">";
                        $items = mysql_query($sql);
                        echo mysql_error();
                        while ($item = mysql_fetch_array($items))
                        {
                        if($item[2]==&#39;0&#39;)
                        {
                        $tit = "*";
                        }if($item[2]==&#39;1&#39;)
                        {
                        $tit = "³";
                        }if($item[2]==&#39;2&#39;)
                        {
                        $tit = "¹";
                        } if($item[2]==&#39;3&#39;)
                        {
                        $tit = "ª";
                        } if($item[2]==&#39;4&#39;)
                        {
                        $tit = "º";
                        } if($item[2]==&#39;5&#39;)
                        {
                        $tit = "°";
                        }

                        $sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name=&#39;$item[0]&#39;"));
                        if($sex[0]=="M"){$usersex = "<img src=\"../phpThumb/phpThumb.php?src=../images/male.gif\" alt=\"(M)\"/>";}
                        if($sex[0]=="F"){$usersex = "<img src=\"../phpThumb/phpThumb.php?src=../images/female.gif\" alt=\"(F)\"/>";}
                        if($sex[0]==""){$usersex = "";}

                        if($items[&#39;ghost&#39;] == 0)
                        $lnk = "$usersex <a href=\"users.php?action=viewuser&amp;who=$item[4]&amp;sid=$sid\">$tit$item[0]</a>";
                        else
                        $lnk = (ismod(getuid_sid($sid)) ? "$usersex <a href=\"users.php?action=viewuser&amp;who=$item[4]&amp;sid=$sid\">$tit$item[0]</a>" : "");

                        echo ($items[&#39;ghost&#39;] == 0 ? "$lnk ~ $item[2]
                        </p>" : (ismod(getuid_sid($sid)) ? "$lnk ~ $item[2]
                        </p>" : ""));

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

                        if($page>1){$ppage = $page-1;
                        echo "<a href=\"main.php?action=online&amp;page=$ppage&amp; sid=$sid\">«Prev</a> ";}
                        if($page<$num_pages){$npage = $page+1;
                        echo "<a href=\"main.php?action=online&amp;page=$npage&amp; sid=$sid\">Next»</a>";}
                        echo "
                        $page/$num_pages";if($num_pages>2){echo getjumper($action, $sid,"main");}
                        echo "</p>";

                        //// UNTILL HERE >>
                        echo "<p align=\"center\">";
                        $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
                        echo "<a accesskey=\"2\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox</a>

                        <a accesskey=\"5\" href=\"forums.php?action=forumindx&amp;sid=$sid\"> Forums</a>

                        <a accesskey=\"2\" href=\"main.php?action=onmood&amp;sid=$sid\">Chang e Mood</a>

                        <a accesskey=\"3\" href=\"chat1.php?action=chat&amp;sid=$sid\">ChatRo oms($chs[0])</a>

                        <a accesskey=\"4\" href=\"main.php?action=main&amp;sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"\"/>Main Menu</a>
                        </p>
                        </body>";
                        exit();}
                        </div>

                        See what that does. as i said i dont ever use this script so it might be a case of trial and error. but it should hopefully work .. u may just need to mess with a few things to get it perfect

                        Let me know

                        Comment


                          #13
                          lol its not working m8 ive played about wid it even tryed
                          <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
                          if($items[&#39;ghost&#39;] == &#39;0&#39;)
                          $lnk = "$usersex $tit<a href=\"users.php?action=viewuser&amp;who=$item[4]&amp;sid=$sid\"$color>$item[0]<img src=\"../phpThumb/phpThumb.php?src=../images/ghost.gif\" alt=\"Ghost\"/></a>";
                          else
                          $lnk = if(ismod(getuid_sid($sid)) ? "$usersex $tit<a href=\"users.php?action=viewuser&amp;who=$item[4]&amp;sid=$sid\"$color>$item[0]</a>" : "");
                          echo ($items[&#39;ghost&#39;] == &#39;1&#39; ? "$lnk ~ $item[3]
                          " : if(ismod(getuid_sid($sid)) ? "$lnk ~ $item[3]
                          " : ""));
                          }
                          </div>
                          but nothing when i go in to ghost mode

                          Comment


                            #14
                            ah well it was a long shot.. as i said ive never touched lavalair or any other wap script apart from a few basic edits i did for a couple of ppl. About the only thing i can offer is either backup your site and send me the site files to work with or set up temporary ftp access for a few hours and i&#39;ll see if i can figure it out.

                            Basically what you wanna do is

                            - always update the users online status. if they are ghosting or not it does not matter

                            - When you come to view online users, inside the loop that displays the users you need to first check if ghost is enabled for that user, if it IS NOT then display as normal .. if IT ISthen you need to check if the current user viewing the list is staff or not .. if IS staff then display the user , if not then display nothing

                            ------------

                            as i said it was a long shot at best ... i can explain code without working with it but i cant provide and copy and paste solution off the top of my head

                            Comment


                              #15
                              its ok i got it working you code was right just had to change a few lil things lol thanks m8

                              Comment

                              Working...
                              X