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

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

Author Topic: Raid points to a html/php page?  (Read 4136 times)

0 Members and 1 Guest are viewing this topic.

Offline ronsu

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
Raid points to a html/php page?
« on: August 18, 2009, 08:47:34 am »
Is it possible to print out raid points gained through !raid to a php or html page?

EDIT: For example, how could I create a module that creates / updates a simple www-page or text page I could show on my web server, say... Every 30 minutes?
« Last Edit: August 18, 2009, 02:16:25 pm by ronsu »

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Raid points to a html/php page?
« Reply #1 on: August 18, 2009, 07:35:12 pm »
The beauty of BeBot is that all data is stored in a MySQL database.

You simply need to write a web page that accesses this database and pulling the relevant information from there. Although the approach you mention would also be possible of course by using the crontab feature of BeBot to write a module that every x minutes writes a webpage containing updated data.

You will however need both HTML, MySQL and preferably PHP knowledge to pull this off if you desire to undertake this yourself.

If anyone wanted to undertake the task, it would be simple to create a complete web based frontend to BeBot allowing access to settings, members, raid points, logs and so forth.
BeBot Founder and Fixer Kingpin

Offline ronsu

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Raid points to a html/php page?
« Reply #2 on: August 18, 2009, 07:42:17 pm »
I'm afraid I dont have enough knowledge of php/mysql to do this.

But I'm going to try anyway.

What are the mysql table names I need to retrieve for the points information?

EDIT: How are all the tables named? I know the prefix ofc, since its configurable.
« Last Edit: August 18, 2009, 07:46:14 pm by ronsu »

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Raid points to a html/php page?
« Reply #3 on: August 18, 2009, 07:49:23 pm »
The tables related to raids are:
<prefix>_raid_log
<prefix>_raid_points
<prefix>_raid_points_log

Feel free to ask questions as you go along, but this is a great chance to learn a little bit. What you are trying to do is relatively simple.

For the web page (php script) you can use a MySQL class to help you along like for example: http://www.ricocheting.com/scripts/php_mysql_wrapper.php
BeBot Founder and Fixer Kingpin

Offline ronsu

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Raid points to a html/php page?
« Reply #4 on: August 21, 2009, 10:58:14 am »
Thanks for your help.

I've managed to create a very simple and !!!UNSECURE!!!! php script.

Now I can work on and improve it. This simple page prints out the characters & points, sorting charater with most points as nr.1

Here is the php so far. Like you said, it was very simple. Please remember, this is NOT secure way and you should use the wrapper instead.

If someone for any reason wants to use this code, you need to change:
1. mysql_server
2. username = mysql user
3. password = mysql pass
4. database_name (from mysql_select_db and $data) = your db name

EDIT:
Please check next post for a more proper code.
« Last Edit: August 22, 2009, 12:23:05 am by ronsu »

Offline Nogoal

  • BeBot Apprentice
  • ***
  • Posts: 77
  • Karma: +0/-0
Re: Raid points to a html/php page?
« Reply #5 on: August 21, 2009, 01:21:17 pm »

<?php
// Connects to your Database
mysql_connect("mysql_server""username""password") or die(mysql_error());
mysql_select_db("database_name") or die(mysql_error());
$data mysql_query("SELECT nickname, points FROM database_name_raid_points WHERE points > 0 ORDER BY points DESC"
or die(
mysql_error());
print 
'<table border="0" cellpadding="3">
  <tr>
    <th>Name:</th>
    <th>Points:</th>
  </tr>'
;
while(
$info mysql_fetch_array$data ))
{
print 
'
  <tr>
    <td>' 
$info['nickname'] . '</td>
    <td>' 
$info['points'] . ' </td>
  </tr>'
;
}
print 
'</table>';
?>


Would look better imho.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Raid points to a html/php page?
« Reply #6 on: August 21, 2009, 02:52:47 pm »
What Nogoal said.

Also notice the usage of single quotes ' instead of double quotes " in Nogoals code.

Whenever possible use single quotes unless you need PHP to interprate anything in the string. Ie:
Code: [Select]
$string = 'Hi mom';
echo "Something: $string";
// Outputs: Something: Hi mom

echo 'Something: $string';
// Outputs: Something: $string

Using single quotes means the code will run faster :)
BeBot Founder and Fixer Kingpin

Offline ronsu

  • BeBot Rookie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: Raid points to a html/php page?
« Reply #7 on: August 22, 2009, 12:13:22 am »
Thank you very much for your comments.

Like I said earlier, I didnt even think I had enough php / mysql knowledge to do this in first place. This is a learning process for me. And what you just replied, tought me yet another thing I didnt know about php.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Raid points to a html/php page?
« Reply #8 on: August 22, 2009, 12:39:04 am »
Most welcome.

It's actually quite fun when you start figuring out how to do things you want to accomplish :) And PHP for the most part makes it fairly easy. The php.net functions manual is also very handy and contains loads of examples that can help you along.
BeBot Founder and Fixer Kingpin

 

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


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 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: 661
  • 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