[Znote AAC] Account VIP list (TFS 0.3)

Discussion in 'Website Applications' started by cbrm, Oct 8, 2012.

  1. cbrm

    cbrm Just another mod Staff Member Global Moderator

    Joined:
    Jan 6, 2009
    Messages:
    6,541
    Likes Received:
    834
    Best Answers:
    0
    Preview:

    [​IMG]

    Edit /layout/widgets/loggedin.php

    Below:

    PHP:
    1.  
    2.             <li>
    3.                 <a href='myaccount.php'>My Account</a>
    4.             </li>
    5.  

    Add:

    PHP:
    1.  
    2.             <li>
    3.                 <a href='friends.php'>My Friends</a>
    4.             </li>            
    5.  
    friends.php
    PHP:
    1.  
    2. <?php
    3. #    TFS 0.3 VIP Friends for ZnoteAAC
    4. #    By cbrm @ otland.net
    5.  
    6. require_once 'engine/init.php';
    7. protect_page();
    8. include 'layout/overall/header.php';
    9.  
    10. echo'<h1>VIP Friends</h1>';
    11. $vip = mysql_query('SELECT
    12.                        p.name AS name, p.id AS id, p.online AS online, player_id
    13.                    FROM
    14.                        account_viplist
    15.                    LEFT JOIN
    16.                        players p ON account_viplist.player_id = p.id
    17.                    WHERE
    18.                        account_viplist.account_id = '.$user_data['id'].'
    19.                    ORDER BY
    20.                        name, online ASC LIMIT 0,100');
    21. while ($row = mysql_fetch_assoc($vip)) {$data[] = $row;}
    22. if (empty($data)) {echo 'You VIP list is empty.'; return include 'layout/overall/footer.php';}
    23. ?>
    24.  
    25. <table><tr class="yellow"><td width="60%"><strong>Name</strong></td><td width="40%"><strong>Status</strong></td></tr>
    26.  
    27. <?php
    28. foreach($data as $friend)
    29. {
    30.     echo '<tr><td><a href="characterprofile.php?name='.$friend['name'].'">'.$friend['name'].'</a></td>';
    31.     echo '<td><span style="color:'.($friend['online'] == 0 ?  'red;">Offline':'green;">Online').'</span></td></tr>';
    32. }
    33. echo'</table>'; include 'layout/overall/footer.php'; ?>
     
    Last edited: Oct 9, 2012
    trollebror and lopez65 like this.
  2. bok

    bok Member

    Joined:
    Apr 28, 2009
    Messages:
    322
    Likes Received:
    4
    Best Answers:
    0
    converter to gesior?
     
  3. killing

    killing Member

    Joined:
    Feb 23, 2012
    Messages:
    817
    Likes Received:
    7
    Best Answers:
    0
    CoooL
     
  4. cbrm

    cbrm Just another mod Staff Member Global Moderator

    Joined:
    Jan 6, 2009
    Messages:
    6,541
    Likes Received:
    834
    Best Answers:
    0
    never, that's a dead aac to me
    tho it's easy to do if you know basic php skills
     
    Evil Puncker likes this.
  5. vipershot

    vipershot New Member

    Joined:
    Dec 30, 2007
    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    nice piece of code but including a sql statement to a variable is rather insecure and easy for hackers to distroy your database, id surgest you doing it another way.
     
  6. goddaniel

    goddaniel Member

    Joined:
    May 9, 2009
    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    How I add a friend in this page?

    Greetings.
     
  7. gerard95

    gerard95 Keep cool :)

    Joined:
    Dec 31, 2011
    Messages:
    276
    Likes Received:
    16
    Best Answers:
    0
    Not working :(
     
  8. Blysco

    Blysco Member

    Joined:
    Oct 12, 2013
    Messages:
    163
    Likes Received:
    2
    Best Answers:
    0
    Works ty :)
     
  9. Snavy

    Snavy Alpha - AUUU

    Joined:
    Apr 1, 2012
    Messages:
    491
    Likes Received:
    40
    Best Answers:
    3
    @BUMP

    Convert to GESIOR plox:D
     
  10. Znote

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

    Joined:
    Feb 14, 2008
    Messages:
    6,361
    Likes Received:
    1,058
    Best Answers:
    148
    Improved script a bit, giving it TFS 1.0 support and Znote AAC 1.5 support. (you must use mysqli or Znote SQL functions to make it work in Znote AAC 1.5).
    PHP:
    1.  
    2. <?php
    3. #    TFS 0.2, 0.3/4, 1.0 VIP Friends for ZnoteAAC
    4. #    By cbrm @ otland.net
    5. #    Improved by Znote. (This requires Znote AAC 1.4+, and is compatible with Znote AAC 1.5)
    6.  
    7. require_once 'engine/init.php';
    8. protect_page();
    9. include 'layout/overall/header.php';
    10.  
    11. ?>
    12. <h1>VIP Friends</h1>
    13. <?php
    14.  
    15. if ($config['TFSVersion'] !== 'TFS_10') $viplist = mysql_select_multi('SELECT `p`.`name` AS `name`, `p`.`id` AS `id`, `p`.`online` AS `online`, `v`.`player_id` FROM `account_viplist` AS `v` LEFT JOIN `players` AS `p` ON `v`.`player_id` = `p`.`id` WHERE `v`.`account_id` = '.$user_data['id'].' ORDER BY `p`.`name`, `p`.`online` ASC LIMIT 0,100');
    16. else {
    17.     // Lets attempt this at TFS 1.0
    18.     $viplist = mysql_select_multi('SELECT `p`.`name` AS `name`, `p`.`id` AS `id`, `v`.`player_id` FROM `account_viplist` AS `v` LEFT JOIN `players` AS `p` ON `v`.`player_id` = `p`.`id` WHERE `v`.`account_id` = '.$user_data['id'].' ORDER BY `p`.`name` ASC LIMIT 0,100');
    19.     if (!empty($viplist) || $viplist) {
    20.         // Lets find out who are online with just one additional query (not quite sure how to do this with joins)
    21.      
    22.         // Fill up an array that only contains player ids
    23.         $pids = array();
    24.         foreach ($viplist as $p) $pids[] = $p['id'];
    25.      
    26.         // Do a query that returns the online players from that array.
    27.         $onlineData = mysql_select_multi("SELECT `player_id` FROM `players_online` WHERE `player_id` IN (". implode(',', array_map('intval', $pids)) .")");
    28.  
    29.         // Based on onlineData, fill up an array with only ids of players who are logged in.
    30.         $oids = array();
    31.         foreach ($onlineData as $o) $oids[] = $o['player_id'];
    32.      
    33.         // Now lets modify $viplist with online status, we need to use for loop
    34.         // instead of foreach loop to manipulate original array.
    35.         for ($i = 0; $i < count($viplist); $i++) {
    36.             if (in_array($viplist[$i]['id'], $oids)) $viplist[$i]['online'] = 1;
    37.             else $viplist[$i]['online'] = 0;
    38.         }
    39.     }
    40. }
    41.  
    42. if (empty($viplist) || !$viplist) echo 'You VIP list is empty.';
    43. else {
    44.     ?>
    45.     <table>
    46.         <tr class="yellow">
    47.             <td width="60%">
    48.                 <strong>Name</strong>
    49.             </td>
    50.             <td width="40%">
    51.                 <strong>Status</strong>
    52.             </td>
    53.         </tr>
    54.         <?php
    55.         foreach ($viplist as $friend) {
    56.             ?>
    57.             <tr>
    58.                 <td>
    59.                     <a href="characterprofile.php?name=<?php echo $friend['name']; ?>">
    60.                         <?php echo $friend['name']; ?>
    61.                     </a>
    62.                 </td>
    63.                 <td>
    64.                     <?php
    65.                     if ($friend['online'] == 0) echo '<span style="color: red;">Offline</span>';
    66.                     else echo '<span style="color: green;">Online</span>';
    67.                     ?>
    68.                 </td>
    69.             </tr>
    70.             <?php
    71.             }
    72.             ?>
    73.     </table>
    74.     <?php
    75. }
    76.  
    77. include 'layout/overall/footer.php'; ?>
    78.  
    I havent tested it yet so somebody please test it and give feedback. :)
     
    Last edited: Mar 21, 2014
    Athenuz and cbrm like this.
  11. cbrm

    cbrm Just another mod Staff Member Global Moderator

    Joined:
    Jan 6, 2009
    Messages:
    6,541
    Likes Received:
    834
    Best Answers:
    0
    Thanks Znote ;p I barely have time to moderate lately and not update this
     
    Evil Puncker likes this.
  12. imback1

    imback1 Unknown member

    Joined:
    Jul 11, 2013
    Messages:
    766
    Likes Received:
    43
    Best Answers:
    1
    Hmm It's not working with me :S i Don't know the reason i made everything like you said
    [​IMG]
     
  13. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    2,024
    Likes Received:
    238
    Best Answers:
    2
    not dead anymore. ^^
     
  14. Tarek1337

    Tarek1337 Well-Known Member

    Joined:
    Jun 9, 2012
    Messages:
    3,552
    Likes Received:
    1,129
    Best Answers:
    3
    You sure ? The last update was in 2012? WE ARE IN 2015
     
  15. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    2,024
    Likes Received:
    238
    Best Answers:
    2
    yes but people still use gesior is what im saying....
     
  16. Tarek1337

    Tarek1337 Well-Known Member

    Joined:
    Jun 9, 2012
    Messages:
    3,552
    Likes Received:
    1,129
    Best Answers:
    3
    Ye, NOOBS use Gesior ;*
     
    Evil Puncker likes this.
  17. God Mythera

    God Mythera Well-Known Member

    Joined:
    Aug 11, 2012
    Messages:
    2,024
    Likes Received:
    238
    Best Answers:
    2
    nah gesior is just easier, since !shop is gay and you need to pay someon to fix ;d gesior is awesome cause its automatic shop system, im also using gesior 2012 for uniserver, its pretty nice.

    also NOOBS use znote cause its fast & easy to setup and they can get there money making ots online......
     
    Last edited by a moderator: May 28, 2015
  18. Evil Puncker

    Evil Puncker I'd rather kiss a rattlesnake

    Joined:
    May 30, 2009
    Messages:
    5,357
    Likes Received:
    1,593
    Best Answers:
    1
    2015 and yet people are running 8.6 server because they didn't learn how to move forward :)
     
    HalfAway and Tarek1337 like this.
  19. Tarek1337

    Tarek1337 Well-Known Member

    Joined:
    Jun 9, 2012
    Messages:
    3,552
    Likes Received:
    1,129
    Best Answers:
    3
    Evil, i wan't to cry. :((, Znote is a great AAC, i am very happy that theres many scripts that doesn't exist to Gesior or 0.x. LOVE TO ZNOTE AND TFS 1.X <33
     
  20. HalfAway

    HalfAway #1

    Joined:
    Sep 3, 2011
    Messages:
    3,604
    Likes Received:
    2,330
    Best Answers:
    15
    Why wouldn't someone use something that's still being developed and works perfect?

    If you search you'll find an automatic shop, for TFS 1.? but we are moving forward so leave the old client versions.
    https://otland.net/threads/automatic-znote-aac-shop-tfs-1-0.224483/

    Explain whats makes GesiorAAC easier than ZnoteAAC?.
     
    Tarek1337 likes this.

Share This Page

Loading...