A little script...

Results 1 to 10 of 10
  1. #1
    Valued Member Lifeles5 is offline
    MemberRank
    Mar 2008 Join Date
    147Posts

    A little script...

    I haven't seen this on any site so...
    I know this is easy...
    But I take a shit on it ;)

    This script displays the currently online characters...

    PHP Code:
    <!--
    ****************************
    *    Made By Lifeless...   *
    *      If you leech it     *
    *  Then no other releases! *
    *  I'm tired of you noobs  *
    * ........................ *
    ****************************
    -->
    <table style="border-width:medium; border-style:dashed">
        <tr>
            <td style='text-align:left;'>Name</td>
            <td style='text-align:right;'>Level</td>
        </tr>
    <?php
    include 'connection.php'//We need to connect to DB eh?
    $_blabla mssql_query("SELECT * FROM Account WHERE LastLoginTime > LastLogoutTime"); //Check if someone is still online
    while($kurvanagylofasz mssql_fetch_array($_blabla)){ //Simple fetch shit...
        
    $aid $kurvanagylofasz['AID'];
        
    $getChar mssql_query("SELECT TOP 1 * FROM Character WHERE AID = \"$aid\" ORDER BY LastTime DESC"); //Get the last char used by the account
        
    while($faszom mssql_fetch_array($getChar)){ //A simple fetch again....
            /*And here we can print out what we want about the character...
            * Feel free to edit this part...
            */
            
    echo "<tr>
                    <td style='text-align:left;'>"
    .$faszom['Name']."</td>
                    <td style='text-align:right;'>"
    .$faszom['Level']."</td>
                  </tr>"
    ;
        }
    }
    ?>
    </table>


  2. #2
    Valued Member lolkiller is offline
    MemberRank
    Sep 2010 Join Date
    Somewhere.Location
    135Posts

    Re: A little script...

    I've seen it somewhere xD, Well good job x].

  3. #3
    Intelligent DoucheBag jur13n is offline
    MemberRank
    Jan 2008 Join Date
    Zwolle,Location
    1,946Posts

    Re: A little script...

    its a little bit crappy in my eyes...

    this works too:
    PHP Code:
    <?php
    include 'config.php'//connection
     
    $i 1;    
        
    $query mssql_query("SELECT TOP 1 Name, Level FROM characters WHERE DeleteFlag = 0 ORDER BY XP/PlayTime DESC"); //searching top by xp times playtime...
        
    while($row mssql_fetch_row($query)) //making rows

        
    {
          echo 
    '<tr><td>'.$i++.'</td>&nbsp;&nbsp;<td><a href="?page=charinfo&name='.$row[0].'">'.$row[0].'</a></td></tr><br>'//showing rows (only name and auto numbering)

        
    }
     
    ?>
    config:
    PHP Code:
    <?php

    class connect
    {
      var 
    $host "..\SQLEXPRESS";   // Host, usually PCNAME\SQLEXPRESS
      
    var $user "sa";                      // Username is usually empty.
      
    var $pass "pass";                     // Password is usually empty.
      
    var $dbn  "GunzDB";              // Database name is most likely GunzDB.

      
    public function __construct()
      {
        
    $con mssql_connect($this->host$this->user$this->pass) or die("<center><font color='red'>Failed to connect to the database!</font></center>");
        
    mssql_select_db($this->dbn$con) or die("<center><font color='red'>Failed to select the database!</font></center>");
      }
    }
    new 
    connect();
    ?>
    credits to SuperWaffle
    and me for editing it O.o
    Last edited by jur13n; 13-05-11 at 06:19 AM.

  4. #4
    Valued Member Lifeles5 is offline
    MemberRank
    Mar 2008 Join Date
    147Posts

    Re: A little script...

    Quote Originally Posted by jur13n View Post
    its a little bit crappy in my eyes...

    this works too:
    PHP Code:
    <?php
    include 'config.php'//connection
     
    $i 1;    
        
    $query mssql_query("SELECT TOP 1 Name, Level FROM characters WHERE DeleteFlag = 0 ORDER BY XP/PlayTime DESC"); //searching top by xp times playtime...
        
    while($row mssql_fetch_row($query)) //making rows

        
    {
          echo 
    '<tr><td>'.$i++.'</td>&nbsp;&nbsp;<td><a href="?page=charinfo&name='.$row[0].'">'.$row[0].'</a></td></tr><br>'//showing rows (only name and auto numbering)

        
    }
     
    ?>
    config:
    PHP Code:
    <?php

    class connect
    {
      var 
    $host "..\SQLEXPRESS";   // Host, usually PCNAME\SQLEXPRESS
      
    var $user "sa";                      // Username is usually empty.
      
    var $pass "pass";                     // Password is usually empty.
      
    var $dbn  "GunzDB";              // Database name is most likely GunzDB.

      
    public function __construct()
      {
        
    $con mssql_connect($this->host$this->user$this->pass) or die("<center><font color='red'>Failed to connect to the database!</font></center>");
        
    mssql_select_db($this->dbn$con) or die("<center><font color='red'>Failed to select the database!</font></center>");
      }
    }
    new 
    connect();
    ?>
    credits to SuperWaffle
    and me for editing it O.o
    LOL. This does not display the currently online characters...

  5. #5
    Intelligent DoucheBag jur13n is offline
    MemberRank
    Jan 2008 Join Date
    Zwolle,Location
    1,946Posts

    Re: A little script...

    Quote Originally Posted by Lifeles5 View Post
    LOL. This does not display the currently online characters...
    oh lawl i thought it was #1 player..
    my bad
    also it still looks messy :$

  6. #6
    Valued Member Lifeles5 is offline
    MemberRank
    Mar 2008 Join Date
    147Posts

    Re: A little script...

    It's my style :D.
    I can read it easily.
    Yours seems messy for me too, but everyone has his/her own coding style.
    And btw, class is completely useless for a connection if you dont use it in a bigger project, but then you should close the connection after every query, so no exploit can be made ;)
    Last edited by Lifeles5; 13-05-11 at 08:06 AM.

  7. #7
    Sultan of Yolo Demantor is offline
    MemberRank
    May 2008 Join Date
    GermanyLocation
    1,266Posts

    Re: A little script...

    The Second While Loop isn't needed lol.

  8. #8
    Pee Aitch Pee Dave is offline
    MemberRank
    Mar 2011 Join Date
    The NetherlandsLocation
    722Posts

    Re: A little script...

    Quote Originally Posted by Lifeles5 View Post
    It's my style :D.
    I can read it easily.
    Yours seems messy for me too, but everyone has his/her own coding style.
    And btw, class is completely useless for a connection if you dont use it in a bigger project, but then you should close the connection after every query, so no exploit can be made ;)
    Closing connections after a query is a joke since it will close after a script is executed anyway.

  9. #9
    Just Me iceman4154 is offline
    MemberRank
    Oct 2007 Join Date
    Columbus, OhioLocation
    217Posts

    Re: A little script...

    Lmao, are you serious?!?!?!?!
    No one is gonna leech this, it's a simple mssql database query. Anyone with the most basic php knowledge can easily do this... This has got to be a joke.

  10. #10
    Valued Member Lifeles5 is offline
    MemberRank
    Mar 2008 Join Date
    147Posts

    Re: A little script...

    Quote Originally Posted by iceman4154 View Post
    Lmao, are you serious?!?!?!?!
    No one is gonna leech this, it's a simple mssql database query. Anyone with the most basic php knowledge can easily do this... This has got to be a joke.
    Then don't use it... make your own and go somewhere else to make useless posts...
    bye...



Advertisement