BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Age of Conan Archive => AoC 0.6.x Custom/Unofficial modules => Topic started by: Exodus00FF on May 12, 2010, 09:53:27 pm

Title: Online Active Users
Post by: Exodus00FF 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.


Now you should be able to Start Testing it.

If everthing works fine it you can move on to loading the Bebot Module
Title: Re: Online Active Users
Post by: Streak 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>';

}

 ?>
Title: Re: Online Active Users
Post by: Kyr on May 19, 2010, 08:51:44 pm
I would love to have a way to access this list from guildlaunch.
Title: Re: Online Active Users
Post by: Exodus00FF 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.
Title: Re: Online Active Users
Post by: knutarn 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)
Title: Re: Online Active Users
Post by: Riccarr 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'


Title: Re: Online Active Users
Post by: MrHaugen 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.
Title: Re: Online Active Users
Post by: SudL 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
Title: Re: Online Active Users
Post by: Drizzurdeen 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
Title: Re: Online Active Users
Post by: WeZoN 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..
Title: Re: Online Active Users
Post by: Drizzurdeen on July 23, 2010, 10:57:34 am
Quote
i removed http:// in $site and it worked..

doesn't work by me ...
Title: Re: Online Active Users
Post by: Argothep 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
Title: Re: Online Active Users
Post by: Khalem 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.
Title: Re: Online Active Users
Post by: Argothep 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
Title: Re: Online Active Users
Post by: Khalem 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.
Title: Re: Online Active Users
Post by: Argothep on September 03, 2010, 12:47:40 am
Allright, did the settings thingy and got same errors. Tried to change http://2010.newrising.org to 2010.newrising.org and at least I don't get any errors in the log atm, seems to be running so far...

Now I might need some assist in thinking, need that working in phpnuke...

Just one thing, will this work if my site CANNOT access the DB of the bot? Cause anyhow I only get bebot running on my locayl drive, tried to run the bot local and use the DB of my homepage but he didn't get any connection so for now Bebot is running local with an apache server and my site is online...


Regards
Title: Re: Online Active Users
Post by: Argothep on September 10, 2010, 07:30:26 pm
Is the question too nooblike to be worth an answer? OK, let me ask the other way...
Am I right if I think that way:

Bebot scans players and sends result to server.php
server.php writes into DB from webspace (not the bot's DB)

So all input I need is already in the DB of my webspace?

Or am I completely wrong?


Regards
Title: Re: Online Active Users
Post by: Khalem on September 11, 2010, 04:43:55 pm
Judging from the first post, yes, that is how it works.

The whole point of this mod is that the bot will often run somewhere else than the webserver, and often there is no way for the webserver to access the MySQL server which holds the database including the Online table. So this sets up an RPC server which receives data and saves it into the local database and has the bot setup as a client that sends data.
Title: Re: Online Active Users
Post by: Argothep on September 22, 2010, 01:43:21 pm
Hehe thx - even if im not that bad in english, sometimes I just miss the clue ^^


Regards
SimplePortal 2.3.7 © 2008-2024, SimplePortal