collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Online Active Users  (Read 19511 times)

0 Members and 1 Guest are viewing this topic.

Offline Exodus00FF

  • BeBot Rookie
  • *
  • Posts: 3
  • Karma: +0/-0
Online Active Users
« on: May 12, 2010, 09:53:27 pm »
In the last few months I began developing a module which is activated by cron, which uploads a list of active online users to a website rpc server.  This is not complete code, but it is the begging of a new project.

Attached to this post are 4 Files.

To begin installation you have to start with the rpc_server.zip file.
  • Begin by unzipping it to your where you host your php based website.
    • I recommend placing the contents in a sub-folder named like xmlrpc.
  • Run the install.sql against your MySQL Database.
  • Set the Following Variables in your server.php file.
    • $dbserver
    • $db
    • $dbuser
    • $dbpassword


Now you should be able to Start Testing it.
  • Unzip the rpc_testclient.zip somewhere and make Change the following 2 Variables.
    • $site = "Domain of where you have server.php installed"
    • $location = "Absolute Path to where you have server.php installed including the leading slash" 
      • /xmlrpc/server.php

If everthing works fine it you can move on to loading the Bebot Module
  • Just copy ActiveUsers.php to your modules/aoc directory.
    • Restart the Bot
    • Change the Site and Locations Settings
    Now the bot should be uploading to the RPC server every 300 seconds.

    Now the tricky part for those of you who don't use joomla.  I'm providing the fourth part as a joomla mod.  For any of you who are coders you shouldn't have any issues converting this into a module that will work with your website, others might have more problems if they don't know php, html, or sql.

    Feel free to modify the code, and repost it here, and I'll update this post as modifications occur.  Bear in mind this is an unfinished project.

Offline Streak

  • BeBot Rookie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Online Active Users
« Reply #1 on: May 19, 2010, 04:20:37 pm »
For a simple Namelisting to be used in e.g. Burning Board just create a new PHP-Box,
copy this code and enter your user variables. Or copy this Code into whatever you are using.

<?
            
                                $hostname = "localhost";
                                 $username = "username";
                                $password = "password";
                                 $dbname = "yourDB";
            
                                   mysql_pconnect ($hostname,$username,$password) or DIE ("not Connected");
            
                                   mysql_select_db ($dbname) or DIE ("Database not found");
                                 
                                   
                                   $query =  "select * from bebot_users where is_online=1";
                                   $result = mysql_query($query) or die ("Query died! Poor Query");
            
                             


 while ( $row = mysql_fetch_row ( $result ) )
{
   
  echo $row[1] . '<br>';

}

 ?>

Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Online Active Users
« Reply #2 on: May 19, 2010, 08:51:44 pm »
I would love to have a way to access this list from guildlaunch.

Offline Exodus00FF

  • BeBot Rookie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Online Active Users
« Reply #3 on: May 25, 2010, 11:36:36 pm »
Streak That only works if your Bot and Website are hosted on the Same Box or have access to the same database.  This is for when your setup has your Bot on a VPS (Virtual Private Server) or local machine b/c your ISP does not allow you to use IRC Bots.
« Last Edit: May 25, 2010, 11:39:11 pm by Exodus00FF »

Offline knutarn

  • BeBot Rookie
  • *
  • Posts: 10
  • Karma: +0/-0
Re: Online Active Users
« Reply #4 on: May 27, 2010, 04:45:12 pm »
For a simple Namelisting to be used in e.g. Burning Board just create a new PHP-Box,
copy this code and enter your user variables. Or copy this Code into whatever you are using.

<?
            
                                $hostname = "localhost";
                                 $username = "username";
                                $password = "password";
                                 $dbname = "yourDB";
            
                                   mysql_pconnect ($hostname,$username,$password) or DIE ("not Connected");
            
                                   mysql_select_db ($dbname) or DIE ("Database not found");
                                 
                                   
                                   $query =  "select * from bebot_users where is_online=1";
                                   $result = mysql_query($query) or die ("Query died! Poor Query");
            
                             


 while ( $row = mysql_fetch_row ( $result ) )
{
   
  echo $row[1] . '<br>';

}

 ?>


Hi can you put rank on it? (Member,Officer,Guild Leader)

Offline Riccarr

  • BeBot User
  • **
  • Posts: 35
  • Karma: +0/-0
Re: Online Active Users
« Reply #5 on: May 27, 2010, 10:52:24 pm »
Streak That only works if your Bot and Website are hosted on the Same Box or have access to the same database.  This is for when your setup has your Bot on a VPS (Virtual Private Server) or local machine b/c your ISP does not allow you to use IRC Bots.

Well, if your of a mind to, you can open a port on your local bot machine (where database is) and connect/query it from the php/web server for live query when the page is hit. Your host connection just needs to include IP and port ...


$hostname = 'xxx.xxx.xxx.xxx:3306'


« Last Edit: June 11, 2010, 03:55:05 am by Riccarr »

Offline MrHaugen

  • BeBot Rookie
  • *
  • Posts: 14
  • Karma: +0/-0
Re: Online Active Users
« Reply #6 on: June 28, 2010, 12:09:51 pm »
Streak That only works if your Bot and Website are hosted on the Same Box or have access to the same database.  This is for when your setup has your Bot on a VPS (Virtual Private Server) or local machine b/c your ISP does not allow you to use IRC Bots.

Well, if your of a mind to, you can open a port on your local bot machine (where database is) and connect/query it from the php/web server for live query when the page is hit. Your host connection just needs to include IP and port ...


$hostname = 'xxx.xxx.xxx.xxx:3306'

Perfect! I'll test it as soon as I can.

Offline SudL

  • BeBot Rookie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: Online Active Users
« Reply #7 on: July 07, 2010, 06:37:12 pm »
i forgott:
with the code from Streak:
there is a problem, when the bot is not online,
the forum is not reachable.

can anyone fix this problem?


thx
« Last Edit: July 10, 2010, 11:35:50 am by SudL »

Offline Drizzurdeen

  • BeBot Apprentice
  • ***
  • Posts: 193
  • Karma: +0/-0
    • Obsidian-Cult
Re: Online Active Users
« Reply #8 on: July 10, 2010, 01:37:45 am »
kk just some questions ;)

i tried to test this but there must be a mistake between my two ears ;)

here my configs
1.
Code: [Select]
/* Define variables to find the rpc server script */
$site = "http://gilde-obsidiancult.de/";
$location = "/srv/www/vhosts/gilde-obsidiancult.de/httpdocs/testumgebung/server.php";
all the files are in one directory ... called testumgebung the link would be http://gilde-osbsidiancult.de/testumgebung

i use joomla
when u look at http://gilde-obsidiancult.de there u will see the mod on the left side but no active user -.-
the bot should be configured correctly ... so i hope ;)

here the log when u look at tes_client
Code: [Select]
Names
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(14) "XMLRPC_request"
    [1]=>
    string(1808) "

Received the following parameter list to send:

Array
(
    [0] => Array
        (
            [array] => Array
                (
                    [data] => Array
                        (
                            [value] => Array
                                (
                                    [0] => Array
                                        (
                                            [string] => Name1
                                        )

                                    [1] => Array
                                        (
                                            [string] => Name2
                                        )

                                    [2] => Array
                                        (
                                            [string] => Name3
                                        )

                                    [3] => Array
                                        (
                                            [string] => Name4
                                        )

                                    [4] => Array
                                        (
                                            [string] => Name5
                                        )

                                    [5] => Array
                                        (
                                            [string] => Name6
                                        )

                                    [6] => Array
                                        (
                                            [string] => Name7
                                        )

                                )

                        )

                )

        )

)


"
  }
}
Success
bool(false)
Response
array(2) {
  ["faultCode"]=>
  int(10532)
  ["faultString"]=>
  string(56) "Connection failed: Couldn't make the connection to http."
}

kk don't know where is the mistake ...

maybee the db is the reason ... couse we don't use bebot_users ... we use for example cultmeister_users and instead of alts we use just alts don't know if this would be case a confligt of ur mod ...

help would be nice ...

greetz drizz

Offline WeZoN

  • Global Moderator
  • *****
  • Posts: 92
  • Karma: +0/-0
Re: Online Active Users
« Reply #9 on: July 22, 2010, 09:52:33 pm »
I get this aswell

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: No such host is known. in "directory"\kd_xmlrpc.php on line 382

Warning: fsockopen() [function.fsockopen]: unable to connect to http:80 (php_network_getaddresses: getaddrinfo failed: No such host is known. ) in "directory"\xmlrpc\kd_xmlrpc.php on line 382


EDIT:

nvm.. i removed http:// in $site and it worked..
« Last Edit: July 22, 2010, 09:56:47 pm by WeZoN »

Offline Drizzurdeen

  • BeBot Apprentice
  • ***
  • Posts: 193
  • Karma: +0/-0
    • Obsidian-Cult
Re: Online Active Users
« Reply #10 on: July 23, 2010, 10:57:34 am »
Quote
i removed http:// in $site and it worked..

doesn't work by me ...

Offline Argothep

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
  • New Rising Leader
    • New Rising Homepage
Re: Online Active Users
« Reply #11 on: August 30, 2010, 03:28:46 pm »
Can't get this running as well...

See my test-client here: http://2010.newrising.org/bebotmodul/test-client.php
The bot itself is running on my HD and working as intended, but if I copy the ActiveUsers.php in the modules directory and want to get the mod running, I get an error in the bot:

Warning: fsockopen(): php_network_getadresses: getaddrinfo failed: Der angegebene Host ist unbekannt. in C:\Users\MyUsername\Desktop\BeBot_Folder\modules\aoc\ActiveUsers.php on line 549

Warning: fsockopen(): unable to connect to http:80 (php_network_getadresses: getaddrinfo failed: Der angegebene Host ist unbekannt. ) in C:\Users\MyUsername\Desktop\BeBot_Folder\modules\aoc\ActiveUsers.php on line 549


Any ideas about a solution?


Regards


Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Online Active Users
« Reply #12 on: August 30, 2010, 09:34:32 pm »
Quote
Warning: fsockopen(): php_network_getadresses: getaddrinfo failed: Der angegebene Host ist unbekannt. in C:\Users\MyUsername\Desktop\BeBot_Folder\modules\aoc\ActiveUsers.php on line 549

Warning: fsockopen(): unable to connect to http:80 (php_network_getadresses: getaddrinfo failed: Der angegebene Host ist unbekannt. ) in C:\Users\MyUsername\Desktop\BeBot_Folder\modules\aoc\ActiveUsers.php on line 549

The script is reporting that it fails to lookup the server address given. And for some reason it has been told to lookup http:80 which obviously is not a valid address.

From a brief glance at the script, check your settings for domain and location for the activeuser module.
BeBot Founder and Fixer Kingpin

Offline Argothep

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
  • New Rising Leader
    • New Rising Homepage
Re: Online Active Users
« Reply #13 on: August 30, 2010, 11:56:00 pm »
Code: [Select]
  $this -> bot -> core("settings") -> create("activeusers", "domain", "http://2010.newrising.org", "Domain to which the RPC Call will be made");
  $this -> bot -> core("settings") -> create("activeusers", "location", "/bebotmodul/server.php", "Absolute Path to server.php");
Looks ok to me, any ideas?


Regards


Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Online Active Users
« Reply #14 on: September 01, 2010, 02:42:03 pm »
Changing info in the php file will only work if the setting does not exist on the bot.

You need to use the ingame !settings activeusers  interface.
BeBot Founder and Fixer Kingpin

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 289
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal