|
|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
| Development::Tools 3rd Party Tools for EQEMu (DB management tools, front ends, etc...) |

05-05-2008, 01:47 PM
|
|
Discordant
|
|
Join Date: Apr 2006
Posts: 374
|
|
That removed the titles but not the corresponding tables. How do I also prevent the tables from displaying? Like I said previously, I just want them to see the following info:
Character Name
Level
Class
This way I can put it up on a website and let all players have access to it, and it does not show everyones account id's and names.
Thanks for taking the time to help.
|
 |
|
 |

05-05-2008, 03:07 PM
|
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
I have been working on it (implemented spell info plus some other tweaks), but I have changed servers since & have to setup the ability to post to Sourceforge via CVS again (which is kind of a pain in the butt).
This project mainly started out to help me hone my PHP abilities while creating some useful tools to use with the emu. I'm sure, eventually, it will get beyond what would be considered the Alpha stage to incorporate permissions, more flexibility, etc, but I doubt that will be anytime soon.
Specifically, if you're looking to display just the Character Name, Level, & Class, you would just have to remove the following code:
Code:
<html>
<head>
<title>EQ Emu - Character List</title>
<?php
$time_start = microtime(true);
include "../includes/constants.php";
include "../includes/functions.php";
if (!isset($_GET["limit"])) {
$_GET["limit"] = 10;
};
if ((!isset($_GET["offset"]) || ($_GET["offset"] == ""))) {
$_GET["offset"] = 0;
};
?>
</head>
<body>
<center><h1>Character List</h1></center>
<table align="center" border="1">
<form method="GET" action="">
<caption align="top" style="text-align:right">
<?php CreateResultLimit();?>
<!-- <input type="text" size="1" name="limit" value="<?php echo $_GET["limit"];?>"> Per Page
<input type="hidden" name="offset" value="<?php echo $_GET["offset"];?>">
<input type="hidden" name="sort" value="<?php echo $_GET["sort"];?>">
<input type="hidden" name="dir" value="<?php echo $_GET["dir"];?>">
<a href="?limit=<?php echo $_GET["limit"];?>&offset=<?php if ($_GET["offset"] - $_GET["limit"] >= 0) {echo $_GET["offset"] - $_GET["limit"];};?>&sort=<?php echo $_GET["sort"];?>&dir=<?php echo $_GET["dir"];?>"><<Prev</a>
<a href="?limit=<?php echo $_GET["limit"];?>&offset=<?php echo $_GET["offset"] + $_GET["limit"];?>&sort=<?php echo $_GET["sort"];?>&dir=<?php echo $_GET["dir"];?>">Next>></a>
--> </caption>
<tr>
<th><?php SortLink(id,'ID');?></th>
<th><?php SortLink(account_name,'Acct');?></th>
<th><?php SortLink(name,'Name');?></th>
<th><?php SortLink(level,'Level','DESC');?></th>
<th><?php SortLink('class','Class');?></th>
<th><?php SortLink(zonename,'Zone Name');?></th>
<!-- <th><?php SortLink(pktime,'PK Time');?></th> -->
<th><?php SortLink(groupid,'Group ID','DESC');?></th>
<th><?php SortLink(timelaston,'Last On','DESC');?></th>
<th><?php SortLink(birthday,'Birthday','DESC');?></th>
</tr>
<?php flush(); ob_flush();?> <tr>
<td align="right">
<?php // CreateDropdown(id,character_);?>
</td>
<td>
<?php // CreateDropdown(account_name,character_);?>
</td>
<td>
<?php // CreateDropdown(name,character_);?>
</td>
<td>
<?php // CreateDropdown(level,character_);?>
</td>
<td>
<?php // CreateDropdown('class',character_);?>
</td>
<td>
<?php CreateDropdown(zonename,character_);?>
</td>
<!-- <td>
<?php // CreateDropdown(pktime,character_);?>
</td>
--> <td align="right">
<?php CreateDropdown(groupid,character_);?>
</td>
<td>
<?php // CreateDropdown(timelaston,character_);?>
</td>
<td>
<?php // CreateDropdown(birthday,character_);?>
</td>
</tr>
</form>
<?php
if ($_GET["account_id"] != "") {
$where = " WHERE account_id=" . $_GET["account_id"] . " ";
};
if (!isset($_GET["sort"]) || ($_GET["sort"] == "")) {
$_GET["sort"] = "timelaston";
};
if (!isset($_GET["dir"]) || ($_GET["dir"] == "")) {
$_GET["dir"] = "DESC";
};
$query1 = "SELECT character_.id, account.name AS account_name, character_.account_id, character_.name, character_.timelaston, character_.x, character_.y, character_.z, character_.zonename, character_.zoneid, character_.pktime, character_.groupid, character_.class, character_.level, CONV(CONCAT(LPAD(BIN(ASCII(SUBSTRING(character_.profile,232,1))),8,'0'),LPAD(BIN(ASCII(SUBSTRING(character_.profile,231,1))),8,'0'),LPAD(BIN(ASCII(SUBSTRING(character_.profile,230,1))),8,'0'),LPAD(BIN(ASCII(SUBSTRING(character_.profile,229,1))),8,'0')),2,10) AS birthday FROM character_ LEFT JOIN account ON account.id=character_.account_id" . $where . " ORDER BY " . $_GET["sort"] . " " . $_GET["dir"] . " ";
// Limit query if $_GET["limit"] is set
if ($_GET["limit"] != "") {
$query1 .= " LIMIT " . $_GET["limit"] . " OFFSET " . $_GET["offset"] . " ";
};
$result1 = mysql_query($query1,$db);
// Display data if any found, message if none found
if ($db_row1 = mysql_fetch_array($result1)) {
do {
// Find out how many characters the account has
global $db;
$query_chars = "SELECT COUNT(id) AS id FROM character_ WHERE account_id='" . $db_row1["account_id"] . "'";
$result_chars = mysql_query($query_chars,$db);
$db_row_chars = mysql_fetch_array($result_chars);
echo "\t<tr>
<td align=\"right\">" . $db_row1["id"] . "</td>
<td title=\"ID: " . $db_row1["account_id"] . "\"><a href=\"../account/?id=" . $db_row1["account_id"] . "\">" . $db_row1["account_name"] . "</a> (<a href=\"?account_id=" . $db_row1["account_id"] . "\">" . $db_row_chars["id"] . "</a>)</td>
<td><a href=\"../inventory/?id=" . $db_row1["id"] . "\">" . $db_row1["name"] . "</a></td>
<td align=\"right\">" . $db_row1["level"] . "</td>
<td>" . $Classes["{$db_row1["class"]}"] . "</td>
<td title=\"X: " . $db_row1["x"] . "\nY: " . $db_row1["y"] . "\nZ: " . $db_row1["z"] . "\">" . $db_row1["zonename"] . "</td>
<!-- <td>" . $db_row1["pktime"] . "</td> -->
<td align=\"right\">" . $db_row1["groupid"] . "</td>
<td>" . date("Y-m-d H:i:s",$db_row1["timelaston"]) . "</td>
<td>" . date("Y-m-d H:i:s",$db_row1["birthday"]) . "</td>
</tr>\n";
flush(); ob_flush();
} while ($db_row1 = mysql_fetch_array($result1));
} else {
echo "\t\t<td align=\"center\" colspan=\"11\">No records found</td>
</tr>";
};
?>
</table>
<?php
include "../includes/footer.php";
?>
</body>
</html>
You'll then want to change the last part that is pink ( colspan=\"11\") to colspan=\"3\", because you only have 3 columns with the changes.
To be honest, I'm not sure what the issue is with the IDs. For the character table (which is really all you're looking at), the IDs are indexed, so MySQL is able to find it a lot faster than searching for a name, which is not indexed. As for the account table, neither the Account ID or Account Name are indexed, so you don't really see a speed difference. However, the Account Name is the same one you login with, so although it might be easier for searches, it would be bad when sharing info about a character, etc, because others will be able to see the account name (and then try guessing the password, etc). In any case, you shouldn't have to worry about the account stuff, since you don't need it for the page you're trying to make.
Anyways, hope this helps.
|
 |
|
 |

05-05-2008, 03:12 PM
|
|
Discordant
|
|
Join Date: Apr 2006
Posts: 374
|
|
Thanks, I will give it a shot.
|
 |
|
 |

05-05-2008, 03:32 PM
|
|
Discordant
|
|
Join Date: Apr 2006
Posts: 374
|
|
Ok here is the revised code. It displays the page perfectly, however when you click on the character name it does not bring you to the magelo-like page. It has an id box then when I type in an id it errors out. I don't mind displaying the ID's if I have to to get that back, I just don't want to display account names for security purposes.
Code:
<head>
<title>EQ Emu - Character List</title>
<?php
$time_start = microtime(true);
include "../includes/constants.php";
include "../includes/functions.php";
if (!isset($_GET["limit"])) {
$_GET["limit"] = 10;
};
if ((!isset($_GET["offset"]) || ($_GET["offset"] == ""))) {
$_GET["offset"] = 0;
};
?>
</head>
<body>
<center><h1>Character List</h1></center>
<table align="center" border="1">
<form method="GET" action="">
<caption align="top" style="text-align:right">
<?php CreateResultLimit();?>
<!-- <input type="text" size="1" name="limit" value="<?php echo $_GET["limit"];?>"> Per Page
<input type="hidden" name="offset" value="<?php echo $_GET["offset"];?>">
<input type="hidden" name="sort" value="<?php echo $_GET["sort"];?>">
<input type="hidden" name="dir" value="<?php echo $_GET["dir"];?>">
<a href="?limit=<?php echo $_GET["limit"];?>&offset=<?php if ($_GET["offset"] - $_GET["limit"] >= 0) {echo $_GET["offset"] - $_GET["limit"];};?>&sort=<?php echo $_GET["sort"];?>&dir=<?php echo $_GET["dir"];?>"><<Prev</a>
<a href="?limit=<?php echo $_GET["limit"];?>&offset=<?php echo $_GET["offset"] + $_GET["limit"];?>&sort=<?php echo $_GET["sort"];?>&dir=<?php echo $_GET["dir"];?>">Next>></a>
--> </caption>
<tr>
<th><?php SortLink(name,'Name');?></th>
<th><?php SortLink(level,'Level','DESC');?></th>
<th><?php SortLink('class','Class');?></th>
</tr>
<?php flush(); ob_flush();?> <tr>
<?php // CreateDropdown(name,character_);?>
</td>
<td>
<?php // CreateDropdown(level,character_);?>
</td>
<td>
<?php // CreateDropdown('class',character_);?>
</td>
</tr>
</form>
<?php
if ($_GET["account_id"] != "") {
$where = " WHERE account_id=" . $_GET["account_id"] . " ";
};
if (!isset($_GET["sort"]) || ($_GET["sort"] == "")) {
$_GET["sort"] = "timelaston";
};
if (!isset($_GET["dir"]) || ($_GET["dir"] == "")) {
$_GET["dir"] = "DESC";
};
$query1 = "SELECT name, class, level FROM character_" . $where . " ORDER BY " . $_GET["sort"] . " " . $_GET["dir"] . " ";
// Limit query if $_GET["limit"] is set
if ($_GET["limit"] != "") {
$query1 .= " LIMIT " . $_GET["limit"] . " OFFSET " . $_GET["offset"] . " ";
};
$result1 = mysql_query($query1,$db);
// Display data if any found, message if none found
if ($db_row1 = mysql_fetch_array($result1)) {
do {
echo "\t<tr>
<td><a href=\"../inventory/?id=" . $db_row1["id"] . "\">" . $db_row1["name"] . "</a></td>
<td align=\"right\">" . $db_row1["level"] . "</td>
<td>" . $Classes["{$db_row1["class"]}"] . "</td>
</tr>\n";
flush(); ob_flush();
} while ($db_row1 = mysql_fetch_array($result1));
} else {
echo "\t\t<td align=\"center\" colspan=\"11\">No records found</td>
</tr>";
};
?>
</table>
<?php
include "../includes/footer.php";
?>
</body>
</html>
|
 |
|
 |
 |
|
 |

05-05-2008, 03:55 PM
|
|
Discordant
|
|
Join Date: Apr 2006
Posts: 374
|
|
This works perfectly, it displays ID, character name, level, and class and links to magelo-like profile:
Code:
<head>
<title>EQ Emu - Character List</title>
<?php
$time_start = microtime(true);
include "../includes/constants.php";
include "../includes/functions.php";
if (!isset($_GET["limit"])) {
$_GET["limit"] = 10;
};
if ((!isset($_GET["offset"]) || ($_GET["offset"] == ""))) {
$_GET["offset"] = 0;
};
?>
</head>
<body>
<center><h1>Character List</h1></center>
<table align="center" border="1">
<form method="GET" action="">
<caption align="top" style="text-align:right">
<?php CreateResultLimit();?>
<!-- <input type="text" size="1" name="limit" value="<?php echo $_GET["limit"];?>"> Per Page
<input type="hidden" name="offset" value="<?php echo $_GET["offset"];?>">
<input type="hidden" name="sort" value="<?php echo $_GET["sort"];?>">
<input type="hidden" name="dir" value="<?php echo $_GET["dir"];?>">
<a href="?limit=<?php echo $_GET["limit"];?>&offset=<?php if ($_GET["offset"] - $_GET["limit"] >= 0) {echo $_GET["offset"] - $_GET["limit"];};?>&sort=<?php echo $_GET["sort"];?>&dir=<?php echo $_GET["dir"];?>"><<Prev</a>
<a href="?limit=<?php echo $_GET["limit"];?>&offset=<?php echo $_GET["offset"] + $_GET["limit"];?>&sort=<?php echo $_GET["sort"];?>&dir=<?php echo $_GET["dir"];?>">Next>></a>
--> </caption>
<tr>
<th><?php SortLink(id,'ID');?></th>
<th><?php SortLink(name,'Name');?></th>
<th><?php SortLink(level,'Level','DESC');?></th>
<th><?php SortLink('class','Class');?></th>
</tr>
<?php flush(); ob_flush();?> <tr>
<td align="right">
<?php // CreateDropdown(id,character_);?>
</td>
<?php // CreateDropdown(name,character_);?>
</td>
<td>
<?php // CreateDropdown(level,character_);?>
</td>
<td>
<?php // CreateDropdown('class',character_);?>
</td>
</tr>
</form>
<?php
if ($_GET["account_id"] != "") {
$where = " WHERE account_id=" . $_GET["account_id"] . " ";
};
if (!isset($_GET["sort"]) || ($_GET["sort"] == "")) {
$_GET["sort"] = "timelaston";
};
if (!isset($_GET["dir"]) || ($_GET["dir"] == "")) {
$_GET["dir"] = "DESC";
};
$query1 = "SELECT character_.id, name, class, level FROM character_" . $where . " ORDER BY " . $_GET["sort"] . " " . $_GET["dir"] . " ";
// Limit query if $_GET["limit"] is set
if ($_GET["limit"] != "") {
$query1 .= " LIMIT " . $_GET["limit"] . " OFFSET " . $_GET["offset"] . " ";
};
$result1 = mysql_query($query1,$db);
// Display data if any found, message if none found
if ($db_row1 = mysql_fetch_array($result1)) {
do {
echo "\t<tr>
<td align=\"right\">" . $db_row1["id"] . "</td>
<td><a href=\"../inventory/?id=" . $db_row1["id"] . "\">" . $db_row1["name"] . "</a></td>
<td align=\"right\">" . $db_row1["level"] . "</td>
<td>" . $Classes["{$db_row1["class"]}"] . "</td>
</tr>\n";
flush(); ob_flush();
} while ($db_row1 = mysql_fetch_array($result1));
} else {
echo "\t\t<td align=\"center\" colspan=\"4\">No records found</td>
</tr>";
};
?>
</table>
<?php
include "../includes/footer.php";
?>
</body>
</html>
Thanks for all the help!
|
 |
|
 |

11-06-2008, 03:46 AM
|
|
Developer
|
|
Join Date: Mar 2007
Location: Ohio
Posts: 648
|
|
I finally made the jump to Google Code, so hopefully I'll make a few updates here every once in a while to make this a little more useful. If anyone is interested in contributing, feel free to send me a PM.
|

08-17-2009, 09:52 AM
|
 |
Legendary Member
|
|
Join Date: Apr 2002
Location: Seattle, WA
Posts: 506
|
|
Quote:
Originally Posted by AndMetal
I finally made the jump to Google Code, so hopefully I'll make a few updates here every once in a while to make this a little more useful. If anyone is interested in contributing, feel free to send me a PM.
|
This morning i spent doing a massive rehaul to this code to make it less exploitive (SQL injections are so abound it's frightening).
I'm cleaning up your constants.php to be more user friendly, and also make it so each feature can be turned on/off with a simple option inside it.
Going through and cleaning up tons of little options, I guess i'll PM you and see if you'd like to add me to your google SVN, even if your last post was over 9 months ago.
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 07:55 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |