Top Online..

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

    Top Online..

    if we already have top poster, top pluses n top chatter..anybody know how to coding top online which show the name of user from the longest online to the shotter online...example in http://methos.co.za

    #2
    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
    ///put in lists.php
    //////////////////////////////////Longest Online

    else if($action=="longon")
    {
    addonline(getuid_sid($sid),"Longets Online","");
    echo "<card id=\"main\" title=\"Longest Online\">";

    //////ALL LISTS SCRIPT <<
    $noi = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE tottimeonl>&#39;0&#39;"));

    if($page=="" || $page<=0)$page=1;
    $num_items = $noi[0]; //changable
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    //changable sql

    $sql = "SELECT id, name, tottimeonl FROM ibwf_users WHERE tottimeonl>&#39;0&#39; ORDER BY tottimeonl DESC LIMIT $limit_start, $items_per_page";


    echo "

    ";
    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {

    $num = $item[2]/86400;
    $days = intval($num);
    $num2 = ($num - $days)*24;
    $hours = intval($num2);
    $num3 = ($num2 - $hours)*60;
    $mins = intval($num3);
    $num4 = ($num3 - $mins)*60;
    $secs = intval($num4);


    $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[0]&amp;sid=$sid\">$item[1]</a>: $days days, $hours hours, $mins mins, $secs seconds";
    echo "$lnk
    ";
    }
    }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
    $ppage = $page-1;
    echo "<a href=\"lists.php?action=longon&amp;page=$ppage&amp ;sid=$sid&amp;view=$view\">«Prev</a> ";
    }
    if($page<$num_pages)
    {
    $npage = $page+1;
    echo "<a href=\"lists.php?action=longon&amp;page=$npage&amp ;sid=$sid&amp;view=$view\">Next»</a>";
    }
    echo "
    $page/$num_pages
    ";
    if($num_pages>2)
    {
    $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
    $rets .= "<anchor>[GO]";
    $rets .= "<go href=\"lists.php\" method=\"get\">";
    $rets .= "<postfield name=\"action\" value=\"$action\"/>";
    $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
    $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
    $rets .= "</go></anchor>";

    echo $rets;
    }
    echo "</p>";
    ////// UNTILL HERE >>
    echo "<p align=\"center\">";
    echo "<a href=\"index.php?action=stats&amp;sid=$sid\"><img src=\"images/stat.gif\" alt=\"*\"/>";
    echo "Site Stats</a>
    ";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
    echo "</p>";
    echo "</card>";
    }
    </div>

    Comment


      #3
      this is my version

      Code:
      if($action=="onmembers")
      {
          addonline(getuid_sid($sid),"Longest Online Members List","");
          $view = $_GET["view"];
          if($view=="")$view="date";
          echo "<card id=\"main\" title=\"Longest Online Members List\">";
          echo "<p align=\"center\">";
          echo "<img src=\"images/bdy.gif\" alt=\"*\"/>
      ";
      
          echo "</p>";
          //////ALL LISTS SCRIPT <<
      
          if($page=="" || $page<=0)$page=1;
          $num_items = regmemcount(); //changable
          $items_per_page= 10;
          $num_pages = ceil($num_items/$items_per_page);
          if(($page>$num_pages)&&$page!=1)$page= $num_pages;
          $limit_start = ($page-1)*$items_per_page;
      
          //changable sql
          if($view=="name")
          {
              $sql = "SELECT id, name, regdate FROM ibwf_users ORDER BY name LIMIT $limit_start, $items_per_page";
          }else if ($view=="date"){
              $sql = "SELECT id, name, tottimeonl FROM ibwf_users ORDER BY tottimeonl DESC LIMIT $limit_start, $items_per_page";
          }else{
              $sql = "SELECT id, name, proviews FROM ibwf_users ORDER BY regdate DESC LIMIT $limit_start, $items_per_page";
          }
      
          echo "
      
      ";
          $items = mysql_query($sql);
          
          if(mysql_num_rows($items)>0)
          {
          while ($item = mysql_fetch_array($items))
          {
            $jdt = date("d-m-y", $item[2]);
      
            $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[0]&amp;sid=$sid\">$item[1]</a> - ";
            echo "$lnk
      ";
      
      //Add this where ever you want to show the total time online:
      $totaltimeonline = mysql_fetch_array(mysql_query("SELECT tottimeonl FROM ibwf_users WHERE id=&#39;".$item[0]."&#39;"));
      $num = $totaltimeonline[0]/86400;
      $days = intval($num);
      $num2 = ($num - $days)*24;
      $hours = intval($num2);
      $num3 = ($num2 - $hours)*60;
      $mins = intval($num3);
      $num4 = ($num3 - $mins)*60;
      $secs = intval($num4);
      
      echo "Total Time Online: 
      ";
      if(($days==0) and ($hours==0) and ($mins==0)){
      echo "[b]$secs[/b] seconds
      ";
      }else
      if(($days==0) and ($hours==0)){
      echo "[b]$mins[/b] mins, ";
      echo "[b]$secs[/b] seconds
      ";
      }else
      if(($days==0)){
      echo "[b]$hours[/b] hours, ";
      echo "[b]$mins[/b] mins, ";
      echo "[b]$secs[/b] seconds
      ";
      }else{
      echo "[b]$days[/b] days, ";
      echo "[b]$hours[/b] hours, ";
      echo "[b]$mins[/b] mins, ";
      echo "[b]$secs[/b] seconds
      ";
      }
      
      
      
          }
          }
          echo "</p>";
          echo "<p align=\"center\">";
          if($page>1)
          {
            $ppage = $page-1;
            echo "<a href=\"lists.php?action=onmembers&amp;page=$ppage&amp;sid=$sid&amp;view=$view\">«PREV</a> ";
          }
          if($page<$num_pages)
          {
            $npage = $page+1;
            echo "<a href=\"lists.php?action=onmembers&amp;page=$npage&amp;sid=$sid&amp;view=$view\">Next»</a>";
          }
          echo "
      $page/$num_pages
      ";
          if($num_pages>2)
          {
            $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
              $rets .= "<anchor>[GO]";
              $rets .= "<go href=\"lists.php\" method=\"get\">";
              $rets .= "<postfield name=\"action\" value=\"$action\"/>";
              $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
              $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
              $rets .= "<postfield name=\"view\" value=\"$view\"/>";
              $rets .= "</go></anchor>";
      
              echo $rets;
          }
          echo "</p>";
        ////// UNTILL HERE >>
          echo "<p align=\"center\">";
          echo "<a href=\"index.php?action=stats&amp;sid=$sid\"><img src=\"images/stat.gif\" alt=\"*\"/>";
      echo "Site Stats</a>
      ";
          echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
      echo "Home</a>";
        echo "</p>";
          echo "</card>";
      }

      Comment


        #4
        whats the link to view the page of the names that should be placed on the site stats page?

        WapCHAT Forum Currenltly changing over to xhtml

        My Dowloads Site

        Comment


          #5
          lists.php?action=longon&amp;stats&amp;sid=$sid

          or something like that

          Comment


            #6
            lol these wanna be php coder are noobs. lol u teach em amy

            Comment


              #7
              i have added powered script

              else if($action=="longon")

              i am getting this error

              <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>

              Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/..../public_html/....../wap/lists.php on line 4442

              Unknown column &#39;tottimeonl&#39; in &#39;field list&#39;
              Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/...../public_html/......./wap/lists.php on line 4459


              </div>

              Comment


                #8
                my online timer doesnt move from 0 seconds. what could be the problem amylee?

                WapCHAT Forum Currenltly changing over to xhtml

                My Dowloads Site

                Comment


                  #9
                  need sql table for this script


                  Unknown column &#39;tottimeonl&#39; in &#39;field list&#39;
                  Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/.../public_html/.../wap/lists.php on line 4459

                  Comment


                    #10
                    Im gonna try to see if i can fix the error and let yall know...

                    WapCHAT Forum Currenltly changing over to xhtml

                    My Dowloads Site

                    Comment


                      #11
                      need sql table for this script
                      Unknown column &#39;tottimeonl&#39; in &#39;field list&#39;
                      Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/.../public_html/.../wap/lists.php on line 4459[/b]
                      you just need to add "tottimeonl" field in the ibwf_users table dude.
                      If you have PHPMyADMIN , go there and add it.

                      Comment


                        #12
                        how can you claim to fix errors without having basic knowledge about php and mysql where you are just copier and paster?
                        add a new row in ibwf_users sql table
                        Code:
                        tottimeonl int(100) default&#39;0&#39; NOT NULL
                        link to be used for code supplied by powered
                        Code:
                        echo "<a href=\"lists.php?action=longon&amp;sid=$sid\">TopOnline<a/>";

                        Comment


                          #13
                          how can you claim to fix errors without having basic knowledge about php and mysql where you are just copier and paster?
                          add a new row in ibwf_users sql table
                          Code:
                          tottimeonl int(100) default&#39;0&#39; NOT NULL
                          link to be used for code supplied by powered
                          Code:
                          echo "<a href=\"lists.php?action=longon&amp;sid=$sid\">TopOnline<a/>";
                          [/b]
                          "how can you claim to fix errors without having basic knowledge about php and mysql..."
                          Well you better add @ <to whom u are saying> from next time or quote a person or else ppl may mistake ya...
                          (PS: If it was to me , there&#39;s no question at all , my work is PHP - MySQL developer , do that daily)

                          Comment


                            #14
                            how can you claim to fix errors without having basic knowledge about php and mysql where you are just copier and paster?
                            add a new row in ibwf_users sql table
                            Code:
                            tottimeonl int(100) default&#39;0&#39; NOT NULL
                            link to be used for code supplied by powered
                            Code:
                            echo "<a href=\"lists.php?action=longon&sid=$sid\">TopOnline<a/>";
                            [/b]
                            "how can you claim to fix errors without having basic knowledge about php and mysql..."
                            Well you better add @ <to whom u are saying> from next time or quote a person or else ppl may mistake ya...
                            [/b]

                            i believe he meant you @dagamer
                            It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                            ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                            ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                            キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                            Comment


                              #15
                              sql?

                              Comment

                              Working...
                              X