Welcome to the RaGEZONE - MMORPG development forums.

Uber/Phx Friends Online

This is a discussion on Uber/Phx Friends Online within the Habbo Releases forums, part of the Habbo Hotel category; Someone was messaging me on MSN asking whether I could create something to list all the friends online for Uber ...

LyncusMU
Results 1 to 12 of 12
  1. #1
    Banned
    Rank
    Banned
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    47
    Liked
    5

    Uber/Phx Friends Online

    Tabo Hotel
    Someone was messaging me on MSN asking whether I could create something to list all the friends online for Uber CMS (Uber or Phoenix database). So here is how I would do it:

    Setup Instructions

    Run the following query in the database of your server.

    Code:
    DROP PROCEDURE IF EXISTS friends;
    
    DELIMITER //
    
    CREATE PROCEDURE friends(IN username VARCHAR(16), OUT friends TEXT)
    LANGUAGE SQL
    DETERMINISTIC
    SQL SECURITY DEFINER
    COMMENT 'Friends Online stored procedure for Uber and Phoenix created by Sniffy.'
    BEGIN
    	DECLARE online_status VARCHAR(1);
    	DECLARE message_nofriends VARCHAR(100);
    	
    	SET online_status = '1';
    	SET message_nofriends = 'You do not have any friends online.';
    	
    	SELECT IFNULL(CONCAT(GROUP_CONCAT('<a href="#">', (SELECT u2.username
    														FROM users u2
    														WHERE u2.id = mf.user_two_id
    															AND u2.online = online_status
    														LIMIT 0,1) SEPARATOR '</a>, <a href="#">'), '</a>.'), message_nofriends)
    	INTO friends
    	FROM users u1
    		INNER JOIN messenger_friendships mf
    			ON mf.user_one_id = u1.id
    	WHERE mf.user_one_id = (SELECT u3.id
    							FROM users u3
    							WHERE u3.username = username
    							LIMIT 0,1);
    END //
    Go to your 'comp-me.tpl' and add the following piece of code within PHP tags at the top of the file.

    PHP Code:
    $username USER_NAME;
    $result1 mysql_query("CALL friends('{$username}', @friends);");
    $result2 mysql_query("SELECT @friends AS friends;");
    $friends mysql_fetch_object($result2)->friends
    Then print the variable '$friends' where ever you would like in your 'comp-me.tpl' to display the user's friends that are online.

    Removal Instructions:

    Run the following query in your database.

    Code:
    DROP PROCEDURE IF EXISTS friends;
    Remove the following code from 'comp-me.tpl'.

    PHP Code:
    $username USER_NAME;
    $result1 mysql_query("CALL friends('{$username}', @friends);");
    $result2 mysql_query("SELECT @friends AS friends;");
    $friends mysql_fetch_object($result2)->friends
    Credits:

    - Sniffy.

  2. HostKey.com: Unmetered Dedicated servers in the Netherlands
  3. #2
    Azure subscription
    Rank
    Subscriber
    Join Date
    Dec 2011
    Location
    єαятн
    Posts
    1,738
    Liked
    263

    Re: Uber/Phx Friends Online

    I'll test this now, but it does look good, thanks :)

  4. #3
    -poke-
    Rank
    Member +
    Join Date
    Jan 2011
    Posts
    236
    Liked
    60

    Re: Uber/Phx Friends Online

    Hope this works <3
    Thankyou so much. Needing this for Ages :L

    EDIT:
    Worked like a charm . Thanks :D.
    Last edited by zuc0001; 27-01-12 at 04:55 AM.

  5. #4
    Programmer
    Rank
    Member +
    Join Date
    Jan 2011
    Location
    home.php
    Posts
    273
    Liked
    72

    Re: Uber/Phx Friends Online

    Kinda old but nice (Y)
    Posted via Mobile Device

  6. #5
    Banned
    Rank
    Banned
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    47
    Liked
    5

    Re: Uber/Phx Friends Online

    No problem gents! Glad you all are making use of this.

  7. #6
    PHP, HTML5, CSS3, JS, C#
    Rank
    Alpha Member
    Join Date
    Jun 2010
    Location
    The Netherlands
    Posts
    1,814
    Liked
    1013

    Re: Uber/Phx Friends Online

    Looks nice, still you didn't explain wy inner join should be better then left join..

    Look forward to an real explanation.
    Posted via Mobile Device

  8. #7
    Banned
    Rank
    Banned
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    47
    Liked
    5

    Re: Uber/Phx Friends Online

    @Hejula, I do not know you so I do not think I would of sent you code, let alone sent you code months ago that I created 2 days ago. Maybe you should post your code rather than accusing me of stealing yours so that we can compare. But of course if you are lying about created a script like this it is fine, no hard feelings. Just do not spam my release thread.

  9. #8
    RaGEZONER
    Rank
    Newbie
    Join Date
    Mar 2010
    Posts
    96
    Liked
    7

    Re: Uber/Phx Friends Online

    This is legit. Tried it on my retro, its PERFECT.

  10. #9
    Banned
    Rank
    Banned
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    47
    Liked
    5

    Re: Uber/Phx Friends Online

    Thanks, I am really happy you are all enjoying this. It is encouraging me to expand on this.

  11. #10
    Developer
    Rank
    Member +
    Join Date
    May 2008
    Posts
    482
    Liked
    201

    Re: Uber/Phx Friends Online

    This opens up a whole new world for me ....LOL

  12. #11
    Banned
    Rank
    Banned
    Join Date
    Jan 2012
    Location
    Canada
    Posts
    47
    Liked
    5

    Re: Uber/Phx Friends Online

    @leenster, no problem. Here to contribute!

  13. #12
    -poke-
    Rank
    Member +
    Join Date
    Jan 2011
    Posts
    236
    Liked
    60

    Re: Uber/Phx Friends Online

    Sniffy, I have a request (if possible :P)
    If you're able to, would you be able to code a script so that it shows your unread minimail messages?
    Because I am integrating minimail into the navigation bar at the top, and I would like it to show your unread messages.
    I'm not the best PHP / SQL coder, so if you're able to do it, I would be grateful<3

    EDIT:
    So that it says like: Minimail (5)
    5 = unread messages etc

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •