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: Post On-/Offline Status to a Website  (Read 7955 times)

0 Members and 1 Guest are viewing this topic.

Offline clashbot

  • BeBot Expert
  • ****
  • Posts: 295
  • Karma: +0/-0
    • Ascension's Home
Re: Post On-/Offline Status to a Website
« Reply #15 on: October 19, 2009, 07:46:09 pm »
still nothing, just a blank page

Offline Getrix

  • Contributor
  • *******
  • Posts: 509
  • Karma: +0/-0
Re: Post On-/Offline Status to a Website
« Reply #16 on: October 19, 2009, 07:55:36 pm »
Make a new .php file with this content:

Code: [Select]
<?php
phpinfo
();
?>

Im starting to belive you dont have mysql client or php installed on your webserver...
Success is not final, failure is not fatal: it is the courage to continue that counts.
- Sorry, i dont have time to reply question on PM. Make a topic.

Offline clashbot

  • BeBot Expert
  • ****
  • Posts: 295
  • Karma: +0/-0
    • Ascension's Home
Re: Post On-/Offline Status to a Website
« Reply #17 on: October 19, 2009, 07:59:07 pm »
should, it's running smf there ;)

PHP Version 5.2.6
mysql 5.0.45

Offline clashbot

  • BeBot Expert
  • ****
  • Posts: 295
  • Karma: +0/-0
    • Ascension's Home
Re: Post On-/Offline Status to a Website
« Reply #18 on: October 19, 2009, 08:09:09 pm »
to rehash, the php file I am using is:
Code: [Select]
<?php 
error_reporting
(E_ALL);
ini_set("display_errors"1); 

//set local variables
$dbhost "xx.xx.xx.xx:3306"
$dbuser "xxxxx"
$dbpass "xxxxx"
$dbname "xxxxx"

//connect 
$db mysql_connect($dbhost,$dbuser,$dbpass) or die                      ('Error connecting to mysql2'); 
mysql_select_db("$dbname",$db) or die ("Database $dbname not select.." mysql_error()); 

// $conn = mysql_connect('67.77.135.21:3306', 'bebot2', 'bebot') or die                      ('Error connecting to mysql2');
// mysql_select_db('bebot',$conn) or die ("Database $DB not select.." . mysql_error());

if (!isset($_GET['sorton']))
{
    
$sorton 'default';
}
else
{
    
$sorton $_GET['sorton'];
}

if (
$sorton == 'nickname')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY online.nickname ASC";
}
else if (
$sorton == 'profession')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.profession ASC, whois.level DESC, whois.defender_rank_id DESC";
}
else if (
$sorton == 'level')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.level DESC, whois.defender_rank_id DESC, whois.profession ASC";
}
else if (
$sorton == 'ai')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.level DESC, whois.defender_rank_id DESC, whois.profession ASC";
}
else
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.profession ASC, whois.level DESC, online.nickname ASC";
}

$result mysql_query($query) or die('error!<br>'.mysql_error());
$total_rows mysql_num_rows$result );
$content "<div style=\"text-align: center\">";
$content $content "<a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=default\">There are <b>$total_rows</b> people online</a><br /><br /></div>";
$content $content "<table border=1 cellspacing=0 style=\"margin-left:auto; margin-right:auto;\"> \n"
$content $content "<tr><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=nickname\">Nickname</a></b></td></td><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=profession\">Profession</a></b></td><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=level\">Level</a></b></td><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=ai\">AI</a></b></td></tr>";
while(
$onlinerow mysql_fetch_row($result))
{
    
$content $content "<tr>";
    foreach ( 
$onlinerow as $data )
    
$content $content "\t <td>$data</td>";
    
$content $content "</td>\n"
}
$content $content "</table>\n";
mysql_free_result($result);
mysql_close($db);
?>

and used this php page to test db connection:
Code: [Select]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>MySQL Test Script</title>
<style>
body { font-family: Verdana; font-size: 10pt; }
td { font-size: 10pt; }
th { font-size: 8pt; }
</style>
</head>
<body>

<?php


if ( isset ( 
$_POST['submit'] ) ) {
?>

<table border="1" summary="" cellpadding="2" cellspacing="0" style="border-collapse: collapse;">
<tr>
<th bgcolor="#F2F2F2" colspan="2"><center><b>Connection Results</b></center></td>
</tr>
<?

if (!$link = @mysql_connect($_POST['mysql_hostname'], $_POST['mysql_username'], $_POST['mysql_password'])) {
?>
<tr>
<td>Connection:</td>
<td bgcolor="red"><font color="white"><?php echo mysql_error(); ?></font></td>
</tr>
<?
} else {
?>
<tr>
<td>Connection:</td>
<td bgcolor="green"><font color="white">Successful!</font></td>
</tr>
<?
}

if (!$dblink = @mysql_select_db($_POST['mysql_database'], $link)) {
?>
<tr>
<td>Database Selection:</td>
<td bgcolor="red"><font color="white"><?php echo mysql_error(); ?></font></td>
</tr>
<?
} else {
?>
<tr>
<td>Database Selection:</td>
<td bgcolor="green"><font color="white">Successful!</font></td>
</tr>
<?
}

@mysql_close($link);
?>
</table>
<?
}

?>

<form method="post">

<table border="1" summary="" cellpadding="2" cellspacing="0" style="border-collapse: collapse;">
<tr>
<th bgcolor="#F2F2F2" colspan="2"><center><b>Enter Your MySQL Information</b></center></td>
</tr>
<tr>
<td>MySQL Hostname</td>
<td><input type="text" name="mysql_hostname" size="40" value="<?php echo $_POST['mysql_hostname']; ?>"></td>
</tr>
<tr>
<td>MySQL Username</td>
<td><input type="text" name="mysql_username" size="40" value="<?php echo $_POST['mysql_username']; ?>"></td>
</tr>
<tr>
<td>MySQL Password</td>
<td><input type="text" name="mysql_password" size="40" value="<?php echo $_POST['mysql_password']; ?>"></td>
</tr>
<tr>
<td>MySQL Database</td>
<td><input type="text" name="mysql_database" size="40" value="<?php echo $_POST['mysql_database']; ?>"></td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset"></center></td>
</tr>
</table>
</form>

</body>
</html>


Offline Getrix

  • Contributor
  • *******
  • Posts: 509
  • Karma: +0/-0
Re: Post On-/Offline Status to a Website
« Reply #19 on: October 19, 2009, 11:22:02 pm »
Ah, maybe i should have been reading the whole script :P

You need print out the $content.

Put
Code: [Select]
print $content;someplace after
Code: [Select]
$content = $content . "</table>\n";
Success is not final, failure is not fatal: it is the courage to continue that counts.
- Sorry, i dont have time to reply question on PM. Make a topic.

Offline clashbot

  • BeBot Expert
  • ****
  • Posts: 295
  • Karma: +0/-0
    • Ascension's Home
Re: Post On-/Offline Status to a Website
« Reply #20 on: October 20, 2009, 12:00:51 am »
that was it! thanks gen

Offline clashbot

  • BeBot Expert
  • ****
  • Posts: 295
  • Karma: +0/-0
    • Ascension's Home
Re: Post On-/Offline Status to a Website
« Reply #21 on: October 22, 2009, 01:02:28 pm »
Ok, I took the hard work you all did, and expanded it to include org names, and the ability to sort by org names.

Code: [Select]
<?php 
error_reporting
(E_ALL);
ini_set("display_errors"1); 

//set local variables
$dbhost "xx.xx.xx.xx"
$dbuser "xxxxx"
$dbpass "xxxxx"
$dbname "xxxxx"

//connect 
$db mysql_connect($dbhost,$dbuser,$dbpass) or die                      ('Error connecting to mysql2'); 
mysql_select_db("$dbname",$db) or die ("Database $dbname not select.." mysql_error()); 



if (!isset(
$_GET['sorton']))
{
    
$sorton 'default';
}
else
{
    
$sorton $_GET['sorton'];
}

if (
$sorton == 'nickname')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.org_name, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY online.nickname ASC";
}
else if (
$sorton == 'profession')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.org_name, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.profession ASC, whois.level DESC, whois.defender_rank_id DESC";
}
else if (
$sorton == 'level')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.org_name, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.level DESC, whois.defender_rank_id DESC, whois.profession ASC";
}
else if (
$sorton == 'org_name')
{
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.org_name, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.org_name ASC, online.nickname ASC";
}
else if (
$sorton == 'ai')
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.org_name, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.level DESC, whois.defender_rank_id DESC, whois.profession ASC";
}
else
{
    
$query  "SELECT online.nickname, whois.profession ,whois.level, whois.org_name, whois.defender_rank_id FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY whois.profession ASC, whois.level DESC, online.nickname ASC";
}

$result mysql_query($query) or die('error!<br>'.mysql_error());
$total_rows mysql_num_rows$result );
$content "<div style=\"text-align: center\">";
$content $content "<a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=default\">There are <b>$total_rows</b> people online</a><br /><br /></div>";
$content $content "<table border=1 cellspacing=0 style=\"margin-left:auto; margin-right:auto;\"> \n"
$content $content "<tr><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=nickname\">Nickname</a></b></td></td><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=profession\">Profession</a></b></td><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=level\">Level</a></b></td><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=org_name\">Org</a></b></td><td><b><a href=\"http://www.clan-ascension.org/onlinestatus.php?pid=1&sorton=ai\">AI</a></b></td></tr>";
while(
$onlinerow mysql_fetch_row($result))
{
    
$content $content "<tr>";
    foreach ( 
$onlinerow as $data )
    
$content $content "\t <td>$data</td>";
    
$content $content "</td>\n"
}
$content $content "</table>\n";
print 
$content;
mysql_free_result($result);
mysql_close($db);
?>


Offline Ossii

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Post On-/Offline Status to a Website
« Reply #22 on: November 11, 2009, 12:30:24 am »
Cant get this to work, seems maybe it not ready for 0.6.5?

First when I use the script as is I get:

error!
Unknown column 'whois.profession' in 'field list'

So I check the whois table and online table and end up removing: whois.profession and whois.defender_rank_id as those doesnt exist, rest does though.. Now I get the error:

error!
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickna' at line 1

"
/usr/bin/mysql  Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2

-

PHP 5.2.6-1+lenny3 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 26 2009 22:16:23)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
"

Offline snyder

  • BeBot User
  • **
  • Posts: 34
  • Karma: +0/-0
  • CRO guild
    • CRO Guild @ Crom
Re: Post On-/Offline Status to a Website
« Reply #23 on: November 11, 2009, 11:26:32 am »
post full sql pls :)

Offline Ossii

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Post On-/Offline Status to a Website
« Reply #24 on: November 11, 2009, 12:34:04 pm »
Hmm dont think that will help? Its the default .sql thats created when installing BeBot 0.6.5, just lots of data filled. Would prefer to not post the whole .sql due to information in it, but what I see regarding the problem is that for example whois.profession would probably be whois.craft1 and whois.craft2

Code: [Select]
--
-- Table structure for table `whois`
--

CREATE TABLE IF NOT EXISTS `whois` (
  `ID` bigint(20) NOT NULL,
  `nickname` varchar(15) NOT NULL default '',
  `level` tinyint(3) unsigned NOT NULL default '1',
  `class` enum('Commoner','Conqueror','Dark Templar','Guardian','Bear Shaman','Priest of Mitra','Scoin of Set','Tempest of Set','Assassin','Barbarian','Ranger','Demonologist','Herald of Xotli','Lich','Necromancer') NOT NULL default 'Commoner',
  `craft1` enum('','Alchemist','Architect','Armorsmith','Gemcutter','Weaponsmith','None') default NULL,
  `craft2` enum('','Alchemist','Architect','Armorsmith','Gemcutter','Weaponsmith','None') default NULL,
  `location` int(15) NOT NULL default '0',
  `online` tinyint(1) NOT NULL default '0',
  `used` bigint(25) NOT NULL default '0',
  `org_rank_id` int(15) NOT NULL default '0',
  `org_rank` int(15) NOT NULL default '0',
  `org_name` varchar(15) default '',
  `updated` int(10) NOT NULL default '0',
  PRIMARY KEY  (`nickname`),
  KEY `ID` (`ID`),
  KEY `Class` (`class`),
  KEY `updated` (`updated`),
  KEY `used` (`used`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

But then again, I got past this issue by removing the references to the non-existing tables.

Main problem now seems to be the query lines, or maybe not? :p

Code: [Select]
error!
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickna' at line 1
« Last Edit: November 11, 2009, 12:47:20 pm by Ossii »

Offline snyder

  • BeBot User
  • **
  • Posts: 34
  • Karma: +0/-0
  • CRO guild
    • CRO Guild @ Crom
Re: Post On-/Offline Status to a Website
« Reply #25 on: November 11, 2009, 02:29:26 pm »
i meant whole sql query you are useing:)

Offline Ossii

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Post On-/Offline Status to a Website
« Reply #26 on: November 11, 2009, 04:04:47 pm »
$query  = "SELECT online.nickname, whois.level, whois.org_name, FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY online.nickname ASC";

Offline Getrix

  • Contributor
  • *******
  • Posts: 509
  • Karma: +0/-0
Re: Post On-/Offline Status to a Website
« Reply #27 on: November 11, 2009, 04:12:06 pm »
Corrected:
Code: [Select]
$query  = "SELECT online.nickname, whois.level, whois.org_name FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY online.nickname ASC";
You got a "," to much after "whois.org_name,".. This was caused when you removed the other values...
Success is not final, failure is not fatal: it is the courage to continue that counts.
- Sorry, i dont have time to reply question on PM. Make a topic.

Offline Ossii

  • BeBot Rookie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Post On-/Offline Status to a Website
« Reply #28 on: November 11, 2009, 05:18:45 pm »
Corrected:
Code: [Select]
$query  = "SELECT online.nickname, whois.level, whois.org_name FROM online, whois WHERE online.status_gc = 1 AND online.nickname = whois.nickname ORDER BY online.nickname ASC";
You got a "," to much after "whois.org_name,".. This was caused when you removed the other values...

Now look at that :) Solved it

Offline snyder

  • BeBot User
  • **
  • Posts: 34
  • Karma: +0/-0
  • CRO guild
    • CRO Guild @ Crom
Re: Post On-/Offline Status to a Website
« Reply #29 on: November 12, 2009, 12:45:25 pm »
thats why i wanted you to post sql :)

 

* 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: 728
  • 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