Back Reply to topic
Goto page 1, 2, 3  Next
kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * *
Release: SQL Posted: Post 06:32 Thu - Jun 26, 2008

Im looking for an example of how to connect to and save/read/delete from a SQL database.

Reason being:
I want to be able to upload online members, KOS list, known zone IDs, ect to tables within a SQL database on my webhost.

This way I can display the information on my website.


Any chance you will be switching over to SQL databases in a upcoming version?

/stick, Chaly
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 403
Posts: 2106
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 08:19 Thu - Jun 26, 2008

i really don't know yet. the reason why ragebot doesn't use mysql right now is that more ppl are able to use the bot without installing mysql and they don't have to now anything about creating a database. using the filesystem with small textfiles isn't the best choice, i know. i thought about xml but this isn't my priority now.
the bot is already writing a status.htm file with the online members. beside the bot's data-storage maybe a ftp - upload is an idea?
the solution for our guild is a bot running on the webserver that doesn't write the status.htm to plugins/buddy/guildbuddies/html/status.htm but to the webserver's directory
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * *
Posted: Post 09:25 Thu - Jun 26, 2008

The problem I have is the webserver and the bot are ran on different machines at different locations.

So my only option would be SQL or FTP.

while I would prefer sql, I would setting for FTP.
im not sure how to make it connect to a FTP server and upload every x minutes

The whole bot thing is outa my league. but I know that "bebot" a chatbot for anarchy online actually came with the PHP server and sql files needed to run it.

Since Anarchy online and Age of Conan use the same chat server setting (except the packet info is a little different)
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 403
Posts: 2106
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 10:12 Thu - Jun 26, 2008

this is a 99% copy&paste from http://de.php.net/manual/de/function.ftp-put.php
Code:
$name = "FILE NAME";
$filename = "FILE NAME WITH FULL PATH";
$ftp_server = "IP ADDRESS"; // Address of FTP server.
$ftp_user_name = " SERVER USERNAME"; // Username
$ftp_user_pass = " SERVER PASSWORD"; // Password
$destination_file = " SERVER FILE PATH TO UPLOAD VIA FTP_PUT";

$conn_id = ftp_connect($ftp_server);
if (!$conn_id) {
   say("FTP :: Cannot make an ftp-connection",1);
   return;
}
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if ("$login_result) {
   say("FTP :: login failed (user or pass incorrect?)",1);
   return;
}
$upload = ftp_put($conn_id, $destination_file.$name, $filename, FTP_BINARY); 
if (!$upload) { 
    say(" FTP :: upload failed",1);
    return;
} else {
    say("FTP :: upload OK!",1);
}
ftp_close($conn_id);

using this somewhere in the buddy/guildbuddies plugin may look like this:
Code:
$name ="status.htm";
$filename = $currentplugin."/html/status.htm";
$ftp_server = "IP ADDRESS"; // Address of FTP server.
$ftp_user_name = " SERVER USERNAME"; // Username
$ftp_user_pass = " SERVER PASSWORD"; // Password
$destination_file = "/var/run/www/mysite/httpdocs/";

if you care about bandwidth and traffic you should think about this twice^^
er.. there are freeware tools out there that sync a local directory with a ftp-site
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
kardson 
(started thread)
Topfight Chicken 
Topics: 6
Posts: 38
Playing:  AOC
Ingame:  kardson
Years registered: * * * * * * * * * * *
Posted: Post 10:31 Thu - Jun 26, 2008

Both My Webhost and my ISP do not have bandwidth caps.
So I should be fine.

I think I'll start playing with this tonight lachen

ty
Reply with quote


Vrykolas 
Blue-Ribbon Chicken 
Topics: 0
Posts: 10
Playing:  Age of Conan
Ingame:  Vrykolas
Years registered: * * * * * * * * * * *
Posted: Post 04:54 Sat - Jun 28, 2008

I've modified some of the files so that data is stored in a database using PDO (by default I've set it to use sqlite so that ppl don't have to install mysql)

The files are available at http://www.oasisavengers.com/botdb.zip

To install it you need to
1) edit inc/bot_database.php and enter the settings at the top of the file (use mysql in $dbconfig['dbtype'] for a mysql database etc.)
2) edit bot.php and enter the line:

require_once("inc/bot_database.php");

below require_once("config.php");

hope this helps you out

Vrykolas
Reply with quote


Snibbeldibbel 
Blue-Ribbon Chicken 
Topics: 3
Posts: 17
 
 
Years registered: * * * * * * * * * * *
Posted: Post 05:24 Sat - Jun 28, 2008

[quote="Vrykolas"]

The files are available at http://www.oasisavengers.com/botdb.zip
[/qoute]

link doesnt work
Reply with quote


Vrykolas 
Blue-Ribbon Chicken 
Topics: 0
Posts: 10
Playing:  Age of Conan
Ingame:  Vrykolas
Years registered: * * * * * * * * * * *
Posted: Post 05:27 Sat - Jun 28, 2008

Sorry - I've corrected that now Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 403
Posts: 2106
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 05:56 Sat - Jun 28, 2008

Vrykolas wrote:
I've modified some of the files so that data is stored in a database using PDO (by default I've set it to use sqlite so that ppl don't have to install mysql)
The files are available at http://www.oasisavengers.com/botdb.zip
To install it you need to
1) edit inc/bot_database.php and enter the settings at the top of the file (use mysql in $dbconfig['dbtype'] for a mysql database etc.)
2) edit bot.php and enter the line:
require_once("inc/bot_database.php");
below require_once("config.php");
hope this helps you out
Vrykolas

nice work.
the zip with 0.7 was ready as i read your thread. i have quickly added an inc/customized that is loaded on bot-startup. just an idea:
maybe you want to put your sql-include to inc/customized, add a line <<include("config-sql.php");>> and deliver an example for this configfile within your zip-package?

i'm sorry but there's a middleage event tonight in the city that i don't want to miss. so i just release 0.7 this evening
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
Guest 
 
Topics: 403
 
 
 
Posted: Post 11:32 Sun - Jun 29, 2008

I've updated the new files from the 0.7.1 release and uploaded them

The files are available at http://www.oasisavengers.com/botdb0.7.1.zip

To install it you need to
1) back up your config-plugins.php
2) edit the config-plugins.php from the archive and enter the settings for the database at the bottom of the file (use mysql in $dbconfig['dbtype'] for a mysql database etc.) and copy any other settings you use from your old file.
2) edit bot.php and enter the line:

require_once("inc/bot_database.php");

below require_once("config.php");
(the database needs to be connected to before it loads the new scripts in the inc/customized folder)

The bot also stores guild members name, class and level in the database after it has seen them log in once, updating the level on login, logout and ding.

Have fun
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 403
Posts: 2106
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * *
Posted: Post 12:46 Sun - Jun 29, 2008

i've two ideas for your release:
1) if you put the bot_database.php in the customized folder too, ppl don't have to edit the bot.php
2) i would suggest you add include("config-db.php") to the bot_database.php. you can deliver this "config-db.php" with the $dbconfig template. so ppl don't have to merge their existing config-plugins.php with a new one.

result should be a zip that can be downloaded, extracted to the bots directory without caring about files that shouldn't be overwritten and only a sql-config-file has to be customized.
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
Vrykolas 
Blue-Ribbon Chicken 
Topics: 0
Posts: 10
Playing:  Age of Conan
Ingame:  Vrykolas
Years registered: * * * * * * * * * * *
Posted: Post 05:17 Mon - Jun 30, 2008

I've updated the files as per your suggestions and fixed the player level not updating if the gratz plugin was disabled.

The files are available at http://www.oasisavengers.com/botdb0.7.1a.zip
Reply with quote


Goto page 1, 2, 3  Next
Back Reply to topic