Online list mood

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

    Online list mood

    Here are the code that im using for my online list
    Code:
    else if($action=="online")
    {
     $showavatar = mysql_fetch_array(mysql_query("SELECT showavatar FROM ibwf_users WHERE id='".$uid."'"));
    $mmsg = htmlspecialchars(getsetmood(getuid_sid($sid)));
      addonline(getuid_sid($sid),"Online list Xhtml-$mmsg","index.php?action=online");
    $pstyle = gettheme($sid);
        echo xhtmlhead("Online List",$pstyle);
        echo "<body>";
    echo "<p align=\"center\">";
    getalert($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.perm, b.place, b.userid, a.sex, a.mood FROM ibwf_users a 
    INNER JOIN ibwf_online b ON a.id = b.userid 
    GROUP BY 1,2 
    LIMIT $limit_start, $items_per_page";
    
      boxstart("Online List");
      echo "<p align=\"left\">";
        $items = mysql_query($sql);
        echo mysql_error();
        while ($item = mysql_fetch_array($items))
        {
            if($item[1]=='0')
            {
              $tit = "";
            }if($item[1]=='1')
            {
              $tit = "&#179;";
            }if($item[1]=='2')
            {
              $tit = "&#178;";
            } if($item[1]=='3')
            {
              $tit = "&#185;";
            } if($item[1]=='4')
            {
              $tit = "&#186;";
            }
    
    $sex = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE name='$item[0]'"));
    if($sex[0]=="M"){$usersex = "<img src=\"images/male.gif\" alt=\"(M)\"/>";}
    if($sex[0]=="F"){$usersex = "<img src=\"images/female.gif\" alt=\"(F)\"/>";}
    if($sex[0]==""){$usersex = "";}
    if($item[1]>'0')
      {
      $lnk = "$usersex<a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$tit$item[0]</a>";
      }else{
      $lnk = "$usersex<a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$tit$item[0]</a>";
      }
    ////////////////////online avatar
     if($showavatar[0]=="1")
    {
    $avlink = getavatar($item[3]);
    if ($avlink!=""){
    echo "<img src=\"$avlink\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }else{
    echo "<img src=\"/images/nopic.jpg\" height=\"25\" width=\"25\" alt=\"avatar\"/>";
    }
    }
      echo "$lnk - $item[2] <br/>";
        }
    $mmsg1 = parsemsg(getsetmood($item[2]), $sid);
          if(!$mmsg1=="")
         {
          echo "($mmsg1) - $item[1] ";
          }else{
          echo "  $item[1]<br/>";
          }
        //echo "</p>";
        //echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">Prev</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next</a>";
        }
        echo "<br/>$page/$num_pages";
        if($num_pages>2)
        {
        echo getjumper($action, $sid,"index");
        }
        echo "</p>";
      ////// UNTILL HERE >>
    
      boxend();
    $nick = getnick_sid($sid);
    boxstart("Menu");
    echo "<a href=\"index.php?action=mood&amp;sid=$sid\">Update Mood</a><br/>";
    $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
    echo "<a href=\"index.php?action=formmenu&amp;sid=$sid\">Forums</a><br/>";
      echo "<a href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
    /////////main menu footer
    echo "<div class=\"footer\">";
       $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
    
      echo xhtmlfoot();
    boxend();
    echo "</div>";
    }
    index
    Code:
    else if($action=="mood")
    
         {boxstart("Set Moods");
            $pstyle = gettheme($sid);
        echo xhtmlhead("Sign a Guestbook",$pstyle);
           echo "<p align=\"center\">";getalert($sid);
            $mmsg = htmlspecialchars(getsetmood(getuid_sid($sid)));
        $uid = getuid_sid($sid);
    echo "<form action=\"genproc.php?action=upmood&amp;sid=$sid\" method=\"post\">";
            echo "SET MOOD TO:<br/><input name=\"mmsg\" maxlength=\"30\"/><br/>";
        echo "<input type=\"Submit\" name=\"submit\" Value=\"Submit\"></form>";
        echo "</p>";
      /////////main menu footer
    echo "<div class=\"footer\">";
       $thid = mysql_fetch_array(mysql_query("SELECT themeid FROM ibwf_users WHERE id='".$uid."'"));
        $themeimageset = mysql_fetch_array(mysql_query("SELECT themedir FROM ibwf_iconset WHERE id='".$thid[0]."'"));
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/themes/$themeimageset[0]/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
    
      echo xhtmlfoot();
    boxend();
    echo "</div>";
    }
    genproc
    Code:
    else if($action=="upmood")
    {$pstyle = gettheme($sid);
    
          echo xhtmlhead("$stitle",$pstyle);
    boxstart("Update Font Size");
         addonline(getuid_sid($sid),"Updating My Mood","");
    $mmsg = $_POST["mmsg"];
         
          echo "<head>";
        echo "<title>Set OnlineList Mood</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/style.css\">";
        echo "</head>";
        echo "<body>";
        echo "<p align=\"center\">";
           $res = mysql_query("UPDATE ibwf_users SET setmood='".$mmsg."' WHERE id='".$uid."'");
      if($res)
            {
                echo "<img src=\"images/ok.gif\" alt=\"o\"/>Mood updated successfully<br/>";
            }else{
              echo "<img src=\"images/notok.gif\" alt=\"x\"/>Can't update your Mood<br/>";
            } 
        echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
        echo "</body>";
    }
    and core
    Code:
    /////////////////////////////////////////////Get Mood
    function getsetmood($uid)
    {
       $getdata = mysql_fetch_array(mysql_query("SELECT setmood FROM ibwf_users WHERE id='".$uid."'"));
       return $getdata[0];
       $text = getsmilies($text);
    }

    #2
    use this code instead.

    saves u adding this for every action
    Code:
    /////////////////////////////////////////online list
    else if($action=="online")
    {
    
      addonline(getuid_sid($sid),"Online List","index.php?action=online");
       echo "<head>";
        echo "<title>Moods</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
    
        echo "</head>";
        echo "<body>";
    echo popup($sid);
    echo "<p align=\"center\">";
    $mols = mysql_fetch_array(mysql_query("SELECT value FROM dave_settings WHERE id='2'"));
        echo "<div>Most Users Online: <b>$mols[0]</b></div><br/>";
    echo "<p align=\"center\">";
        
      //////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;
    
        //changable sql
        $sql = "SELECT
                a.name,a.perm, b.place, b.userid,a.onlinemsg FROM dave_users a
                INNER JOIN dave_online b ON a.id = b.userid
                GROUP BY 1,2
                LIMIT $limit_start, $items_per_page
        ";
      echo "<p align=\"center\">";
        $items = mysql_query($sql);
        echo mysql_error();
        while ($item = mysql_fetch_array($items))
           {
            if($item[1]=='0')
            {
              $tit = "<img src=\"../phpThumb/phpThumb.php?src=../images/member.gif\" alt=\"(Member)\"/>";
            }if($item[1]=='1')
            {
              $tit = "<img src=\"../phpThumb/phpThumb.php?src=../images/mod.gif\" alt=\"(Mod)\"/>";
            }if($item[1]=='2')
            {
              $tit = "<img src=\"../phpThumb/phpThumb.php?src=../images/admin.gif\" alt=\"(M)\"/>";
            } if($item[1]=='3')
            {
              $tit = "<img src=\"../phpThumb/phpThumb.php?src=../images/head.gif\" alt=\"(M)\"/>";
            } if($item[1]=='4')
            {
              $tit = "<img src=\"../phpThumb/phpThumb.php?src=../images/owner.gif\" alt=\"(M)\"/>";
            } if($item[1]=='5')
            {
              $tit = "<img src=\"../phpThumb/phpThumb.php?src=../images/host.gif\" alt=\"(M)\"/>";
            }
    
    
    $sex = mysql_fetch_array(mysql_query("SELECT sex FROM dave_users WHERE name='$item[0]'"));
    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 = "";}
    $text = parsepm($item[4], $sid);
          $lnk = "$usersex<a href=\"index.php?action=viewuser&amp;who=$item[3]&amp;sid=$sid\">$tit$item[0]</a>";
          echo "$lnk ($text) - $item[2] <br/>";
        }
        echo "</p>";
        echo "<p align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?action=online&amp;page=$ppage&amp;sid=$sid\">&#171;Prev</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?action=online&amp;page=$npage&amp;sid=$sid\">Next&#187;</a>";
        }
        echo "<br/>$page/$num_pages<br/>";
        if($num_pages>2)
        {
        echo getjumper($action, $sid,"index");
        }
        echo "</p>";
      ////// UNTILL HERE >>
    
      echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=pshout&amp;sid=$sid\">Update Offline Mood</a><br/>";
      echo "<a href=\"index.php?action=mood&amp;sid=$sid\">Update Online Mood</a><br/>";
      echo "<a href=\"index.php?action=rukiya&amp;sid=$sid\">Profile rating leaders</a><br/>";
    echo "<a href=\"index.php?action=active&amp;sid=$sid\">Active Members</a><br/>";
    $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
      echo "<a href=\"lists.php?action=buds&amp;sid=$sid\">BuddyList</a><br/>";
      echo "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
      echo "<a href=\"index.php?action=forumindx&amp;sid=$sid\">Forums</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"\"/>Home</a>";
      echo "</p>";
      echo "</body>";
    exit();
    }
    //////////////////////////////////////////Update online msg & mood
    else if($action=="mood")
    {
    addonline(getuid_sid($sid),"Updating online msg &amp; mood","");
    
    echo "<head>";
        echo "<title>Online List</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
    echo"<body>";
    echo "<p>";
    
    
    echo "<form action=\"index.php?action=upolm&sid=$sid\" method=\"post\">";
    echo "Mood msg: <input name=\"kiss\" maxlength=\"100\"/><br/>";
    
    echo "<input type=\"Submit\" name=\"submit\" Value=\"Submit\"></form>";
    
    echo "<br/><br/>";
    echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a><br/>";
    
    echo "</p>";
    echo "</body>";
    exit();
    }
    //////////////////////////////////////////Update online msg & mood
    else if($action=="upolm")
    {
    addonline(getuid_sid($sid),"Updating online msg &amp; mood","");
    
    echo "<head>";
        echo "<title>Online List</title>";
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
        echo "</head>";
    echo"<body>";
    $kiss = $_POST["kiss"];
    
    echo "<p align=\"center\">";
    $res = mysql_query("UPDATE dave_users SET onlinemsg='".$kiss."' WHERE id='".$uid."'");
      if($res)
      {
        echo "<img src=\"images/ok.gif\" alt=\"o\"/>Your online msg was updated successfully<br/>";
      }else{
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>Error updating your online msg<br/>";
      }
    echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a><br/>";
    
    echo "</p></body>";
    exit();
    }
    take this line out
    $mmsg = htmlspecialchars(getsetmood(getuid_sid($sid)));

    and edit ya database mood in users table to onlinemsg .

    thats all your need,.
    Wapchat4u


    Topsites4u

    Comment

    Working...
    X