[Znote AAC] Offline Training Page

Discussion in 'Website Applications' started by FabianoBN, Jun 28, 2013.

Tags:
  1. FabianoBN

    FabianoBN l|¬¬"|l

    Joined:
    Jan 23, 2009
    Messages:
    745
    Likes Received:
    21
    Best Answers:
    0
    Hello >:D
    Go to put the Offiline Training in your page?

    In www/engine/function
    Open the life users.php
    go to line 1190 press the ENTER

    and put this:
    PHP:
    1. function training_count_online() {
    2.     return mysql_result(mysql_query("SELECT COUNT(`id`) from `players` WHERE `offlinetraining_skill` > 0;"), 0);
    3. }
    Now, open the file general.php
    go to line 294 press the ENTER
    and put this:
    PHP:
    1. function offtraining_list() {
    2.     $count = training_count_online();
    3.     $query = mysql_query("SELECT `name`, `level`, `vocation` FROM `players` WHERE `offlinetraining_skill`>'0' ORDER BY `name` DESC;");
    4.     for ($i = 0; $i < $count; $i++) {
    5.         $row = mysql_fetch_row($query);
    6.         $array[] = $row;
    7.     }
    8.  
    9.     if (isset($array)) {
    10.         return $array;
    11.     } else {
    12.         return false;
    13.     }
    14. }
    Now, create the file offlinetraininglist.php in your folder www
    and put this:
    PHP:
    1. <?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
    2.  
    3. <h1>Who is Offline Training?</h1>
    4. <?php
    5. $array = offtraining_list();
    6. if ($array) {
    7.     ?>
    8.    
    9.     <table id="onlinelistTable">
    10.         <tr class="yellow">
    11.             <td>Name:</td>
    12.             <td>Level:</td>
    13.             <td>Vocation:</td>
    14.         </tr>
    15.             <?php
    16.             foreach ($array as $value) {
    17.             echo '<tr>';
    18.             echo '<td><a href="characterprofile.php?name='. $value[0] .'">'. $value[0] .'</a></td>';
    19.             echo '<td>'. $value[1] .'</td>';
    20.             echo '<td>'. vocation_id_to_name($value[2]) .'</td>';
    21.             echo '</tr>';
    22.             }
    23.             ?>
    24.     </table>
    25.  
    26.     <?php
    27. } else {
    28.     echo 'Nobody is Offline Training.';
    29. }
    30. ?>
    31. <?php include 'layout/overall/footer.php'; ?>
    Now, in your folder www/layout (if is the layout TIBIACOM)
    Open your rightside.php

    and Change this line:
    PHP:
    1. <a href="onlinelist.php" id="online">Players online: <br><?php echo user_count_online();?></a>
    to:

    PHP:
    1. <a href="onlinelist.php" id="online">Players online: <?php echo user_count_online();?></a><br><a href="offtraininglist.php" id="online">Off Training: <?php echo training_count_online();?></a>

    but if it is the default layout of the Engine ZNote AAC, go to the folder layout/widgets
    open the file serverinfo.php
    and change the line:

    PHP:
    1. <li><a href="onlinelist.php">Players online: <?php echo user_count_online();?></a></li>
    to:

    PHP:
    1. <li><a href="onlinelist.php">Players online: <?php echo user_count_online();?></a><br><a href="offtraininglist.php" id="online">Off Training: <?php echo training_count_online();?></a></li>
    Any questions just ask! Thanks ^^

    Demo: Offline Training
     
    Last edited: Jun 30, 2013
    lopez65 likes this.
  2. Scarlet Ayleid

    Scarlet Ayleid Well-Known Member

    Joined:
    Jul 7, 2007
    Messages:
    4,057
    Likes Received:
    243
    Best Answers:
    0
  3. Evil Puncker

    Evil Puncker I'd rather kiss a rattlesnake

    Joined:
    May 30, 2009
    Messages:
    5,366
    Likes Received:
    1,595
    Best Answers:
    1
    demo please
     
  4. soba

    soba I ♥ Deep House .

    Joined:
    May 10, 2009
    Messages:
    183
    Likes Received:
    5
    Best Answers:
    0
    thx work:)
     
  5. FabianoBN

    FabianoBN l|¬¬"|l

    Joined:
    Jan 23, 2009
    Messages:
    745
    Likes Received:
    21
    Best Answers:
    0
    Scarlet Ayleid
    Thanks for Approving!

    I Add demo :)


    thx
     
    Last edited: Jun 30, 2013
  6. Znote

    Znote <?php echo $title; ?> Staff Member Global Moderator Premium User

    Joined:
    Feb 14, 2008
    Messages:
    6,364
    Likes Received:
    1,059
    Best Answers:
    149
    Looks very nice. :)

    You should try to use more Znote AAC functionality, look at this improvement:

    • mysql_select_single
      • Used to fetch single rows from database.
      • Is false if empty.
      • Returns single array of 1 row. Sample: echo $row['column'];
    • mysql_select_multi
      • Used to select many/multiple rows from database.
      • Is false if empty.
      • Returns multi-array of rows. Sample: foreach(rows as row){ echo row['column']; }
    Sample usage:
    PHP:
    1. <?php
    2. // Last created player welcome
    3. $player = mysql_select_single("SELECT `name` FROM `players` ORDER BY `id` DESC LIMIT 1;");
    4. echo "Welcome to our newest player: ". $player['name'] .". I hope you enjoy your stay!";
    5.  
    6. // List all sorcerers that exist on server. Best sorcerers first.
    7. $sorcerers = mysql_select_multi("SELECT `name`, `level` FROM `players` WHERE `vocation`='1' OR `vocation`='5' ORDER BY `level` DESC;");
    8. if ($sorcerers !== false) {
    9.     echo "There are ". count($sorcerers) ." Sorcerers on this server. Here is the list:\n";
    10.     ?>
    11.     <table>
    12.         <tr>
    13.             <td>Name</td>
    14.             <td>Level</td>
    15.         </tr>
    16.         <?php
    17.         foreach($sorcerers as $sorc) {
    18.             echo "<tr>";
    19.                 echo "<td>". $sorc['name'] ."</td>";
    20.                 echo "<td>". $sorc['level'] ."</td>";
    21.             echo "</tr>";
    22.         }
    23.         ?>
    24.     </table>
    25.     <?php
    26. } else echo "No sorcerers exist on this server yet.";
    27. ?>

    Here I rewrite some of your code to show how it would work with you:
    PHP:
    1. ///////////// Engine function users.php
    2. function training_count_online() {
    3.     $count = mysql_select_single("SELECT COUNT(`id`) AS `value` from `players` WHERE `offlinetraining_skill` > 0;");
    4.     if (!$count) return 0;
    5.     else return $count['value'];
    6. }
    7.  
    8. function offtraining_list() {
    9.     $offlinePlayers = mysql_select_multi("SELECT `name`, `level`, `vocation` FROM `players` WHERE `offlinetraining_skill`>'0' ORDER BY `name` DESC;");
    10.     return $offlinePlayers; // mysql_select_multi will either return false if empty, or array with values if exist.
    11. }
    PHP:
    1. <?php
    2. //////////// PAGE
    3. require_once 'engine/init.php'; include 'layout/overall/header.php';
    4. $players = offtraining_list();
    5. $count = 0;
    6. if ($players !== false) $count = count($players);
    7. ?>
    8.  
    9. <h1>Who is Offline Training? [<?php echo $count; ?>]</h1>
    10. <?php
    11. if ($players !== false) {
    12.     ?>
    13.    
    14.     <table id="onlinelistTable">
    15.         <tr class="yellow">
    16.             <td>Name:</td>
    17.             <td>Level:</td>
    18.             <td>Vocation:</td>
    19.         </tr>
    20.             <?php
    21.             foreach ($players as $player) {
    22.             echo '<tr>';
    23.                 echo "<td><a href='characterprofile.php?name=". $player['name'] ."'>". $player['name'] ."</a></td>";
    24.                 echo "<td>". $player['level'] ."</td>";
    25.                 echo "<td>". vocation_id_to_name($player['vocation']) ."</td>";
    26.             echo '</tr>';
    27.             }
    28.             ?>
    29.     </table>
    30.  
    31.     <?php
    32. } else {
    33.     echo 'Nobody is Offline Training.';
    34. }
    35.  
    36. include 'layout/overall/footer.php'; ?>

    Understand? :thumbup:
     
    lopez65 likes this.
  7. FabianoBN

    FabianoBN l|¬¬"|l

    Joined:
    Jan 23, 2009
    Messages:
    745
    Likes Received:
    21
    Best Answers:
    0
    o_O

    Very Nice! Yes.
     
  8. marcio tadash

    marcio tadash New Member

    Joined:
    Apr 6, 2013
    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    very good! muito bom
     
  9. TibiaLand

    TibiaLand Member

    Joined:
    Oct 20, 2013
    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    I Complet all steps for install offline training page. but not work for me...

    I create the file offlinetraininglist.php and put on folder www

    why is the problem? all steps are complete! thanks


    [​IMG]
     
  10. FabianoBN

    FabianoBN l|¬¬"|l

    Joined:
    Jan 23, 2009
    Messages:
    745
    Likes Received:
    21
    Best Answers:
    0
    use you linux?
    you released file access?
    chmod 777 -R offlinetraininglist.php
     
  11. Blysco

    Blysco Member

    Joined:
    Oct 12, 2013
    Messages:
    163
    Likes Received:
    2
    Best Answers:
    0
    Works for me :)
    I use a Znote ACC website :)
     
  12. gremlee

    gremlee Qumora.com

    Joined:
    Jul 15, 2008
    Messages:
    512
    Likes Received:
    16
    Best Answers:
    0
    I have some problem its says nobody is offline when i know people is afk training :S
    @FabianoBN
    @Znote
     
  13. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    0
  14. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    0
    When you go to the link it says "Noone is offline training" but I know there are! Any idea why? @Znote Account I use is Znote AAC Version: 1.4_
     
  15. lopez65

    lopez65 Member

    Joined:
    May 10, 2012
    Messages:
    231
    Likes Received:
    10
    Best Answers:
    0
    hi @Znote

    znote.png

    How could you put this exemplified Znote 1.5_svn on my page or file that you have to add?

    but how many are put all professions

    greetings and thanks
     
  16. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    0
    Bump my page still says noone is offline training any idea why???????
     
  17. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    0
  18. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    0
    (Sorry it won't let me edit my last post)

    Error:
    Code (Text):
    1. [03-Sep-2014 00:47:52 America/Chicago] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in /home/frostot/public_html/frost-ot/engine/function/users.php on line 1189
     
  19. psychosisneamia

    psychosisneamia ~Beginner~

    Joined:
    Jun 7, 2012
    Messages:
    162
    Likes Received:
    7
    Best Answers:
    0
  20. lopez65

    lopez65 Member

    Joined:
    May 10, 2012
    Messages:
    231
    Likes Received:
    10
    Best Answers:
    0
    Hello
    would be too much to ask that the skill that is trained will see, because only leave those who are training offline, char name, lvl and vocation, no, but would remain more cool if you put the skills that this training, although it is very difficult, because and so it xDD me.
     

Share This Page

Loading...