rank at trivia

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

    rank at trivia

    PHP Code:
    /////////////////////////////////////////Statutus trivia put tihs in core
    
    function trivia($uid)
    {
      $info= mysql_fetch_array(mysql_query("SELECT trivia, sex FROM lib3rtymrc_users WHERE id='".$uid."'"));
      if(isbanned($uid))
      {
        return "Banat(a)!";
      }
         if($info[0]<1000)
        {
          return "Left";
        }else if($info[0]<5000)
        {
           return "Beginner";
        }else if($info[0]<10000)
        {
            return "Amateur";
        }else if($info[0]<15000)
        {
           return "advanced";
        }else if($info[0]<40000)
        {
            return "good";
        }else if($info[0]<70000)
        {
            return "very good";
        }else if($info[0]<80000)
        {
            return "    Super Advanced";
        }else 
        {
            return "Genius";
        }
      } 
    
    PHP Code:
    ////////////////////tihis in profil
      echo "<small>Rang Trivia: <a href=\"trivia.php?actiune=top&amp;sid=$sid\"><b>".trivia($who)."</b></a></small><br/>"; 
    
    PHP Code:
    //////////////////// end tihs in trivia.php
    //////////////////////////////////Top Trivia
    
    
    
    else if($actiune=="top")
    
    {
    
        addonline(getuid_sid($sid),"Vizualizeaza Top Trivia","trivia.php?actiune=$actiune&amp;wap=$r");
    
        echo "<card id=\"main\" title=\"Top Trivia\">";
    
        echo "<p align=\"center\">";
    
        echo "<b>Top Trivia</b>";
    
        echo "</p>";
    
         
    
     
    
        //////ALL LISTS SCRIPT <<
    
    
    
        if($page=="" || $page<=0)$page=1;
    
        $num_items = regmemcount(); //changable
    
        $items_per_page= 20;
    
        $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, trivia FROM lib3rtymrc_users ORDER BY trivia DESC LIMIT $limit_start, $items_per_page";
    
    
    
    
        echo "<p>";
    
        $items = mysql_query($sql);
    
         //$cou =1;
    
        $cou = $limit_start;
    
        echo mysql_error();
    
        if(mysql_num_rows($items)>0)
    
        {
    while ($item = mysql_fetch_array($items))
    
        {
        
          $cou++;
    
          $simbol = getsimbol($item[0]);
    
          $lnk = "<small><b>Locul $cou :</b> <a href=\"profil.php?who=$item[0]&amp;sid=$sid\"> $simbol$item[1]</a> -  $item[2] puncte <br/>".trivia($item[0])."</small>";
    
          echo "$lnk<br/>";
          echo "----<br/>";
    
      
    
        }
    
        }
    
        echo "</p>";
    
        echo "<p align=\"left\">";
    
        if($page>1)
    
        {
    
          $ppage = $page-1;
    
          echo "<small><a href=\"trivia.php?actiune=top&amp;page=$ppage&amp;sid=$sid&amp;view=$view\">pagina anterioara</a></small><br/> ";
    
       }
    
        if($page<$num_pages)
    
        {
    
          $npage = $page+1;
    
          echo "<small><a href=\"trivia.php?actiune=top&amp;page=$npage&amp;sid=$sid&amp;view=$view\">pagina urmatoare</a></small>";
    
        }
    
        echo "<br/>$page din $num_pages<br/>";
    
        if($num_pages>2)
    
        {
    
          $rets = "Du-te la pagina:<input name=\"pg\" format=\"*N\" size=\"3\"/>";
    
            $rets .= "<anchor>[du-te]";
    
            $rets .= "<go href=\"trivia.php\" method=\"get\">";
    
            $rets .= "<postfield name=\"actiune\" value=\"$actiune\"/>";
    
            $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";
    
            $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";
    
            $rets .= "</go></anchor>";
    
    
    
            echo $rets;
    
        }
    
        echo "</p>"; 
    
    Last edited by metulj; 23.05.09, 08:16. Reason: thanks for sharing, but please use [ php ] ... [ / php ] tag for posting code

    #2
    I would very grateful if you would set the entire script of trivia, search everywhere, but not generous.Tnx

    Comment


      #3
      it's my work :-W ahhh X(

      here is it :P
      Attached Files
      Last edited by metulj; 23.05.09, 17:48. Reason: no need to quote such long post..
      <?php unlink('World/Europe/Romania.country'); ?>

      Comment


        #4
        Missing me yet another pair of details.Probably go in core.php

        addtotrivia()

        I thank you a lot!!!!

        Comment


          #5
          PHP Code:
          function addtotrivia($uid)
          {
            $timeto = 150;
            $timenw = time();
            $timeout = $timenw - $timeto;
            $exec = mysql_query("DELETE FROM lib3rtymrc_onlinetrivia WHERE lton<'".$timeout."'");
            $res = mysql_query("INSERT INTO lib3rtymrc_onlinetrivia SET lton='".time()."', uid='".$uid."'");
            if(!$res)
            {
              mysql_query("UPDATE lib3rtymrc_onlinetrivia SET lton='".time()."' WHERE uid='".$uid."'");
            }
          } 
          
          <?php unlink('World/Europe/Romania.country'); ?>

          Comment


            #6
            Sorry bro but this miss too Call to undefined function isoprit()
            And thanks again!

            Comment


              #7
              PHP Code:
              function isoprit($str,$sender)
              {
                $str = str_replace(" ","",$str);
                $str = strtolower($str);
                  $res = mysql_query("SELECT browser FROM lib3rtymrc_pc");
              while ($row = mysql_fetch_array($res)) 
              {
                 $sites[] = $row[0];
              }
                for($i=0;$i<count($sites);$i++)
                {
                      $nosf = substr_count($str,$sites[$i]);
                  if($nosf>0)
                  {
                    return false;
                  }
                }
                return true;
              } 
              
              PHP Code:
              --
              -- Structura de tabel pentru tabelul `lib3rtymrc_pc`
              --
              
              CREATE TABLE IF NOT EXISTS `lib3rtymrc_pc` (
                `id` int(11) NOT NULL auto_increment,
                `browser` varchar(255) NOT NULL default '',
                PRIMARY KEY  (`id`)
              ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=52 ;
              
              --
              -- Salvarea datelor din tabel `lib3rtymrc_pc`
              -- 
              
              Last edited by i0nutzxp; 24.05.09, 16:45.
              <?php unlink('World/Europe/Romania.country'); ?>

              Comment


                #8
                Tnx mete You helped me a lot!

                Comment

                Working...
                X