Im going to to my best to create php snippets to interact with some plugins via their SQL Databases. Such as xAuth, BigBrother and so forth. Feel free to reply with your own snippets and see if we can make a collection and maybe a full front end. Something like PHPMyAdmin but for Minecraft. I also create small 'APIs' to do things that are a laborious task, feel free to use the 'API' with your PHP Snippets. I intend to keep them running. Heres my Minecraft Skin's Face: xAuth registered users list: http://pastebin.com/V1SpgYRp Paste it where you would like the list to appear. It will create a list of users reigstered and their face displayed to the left. Example: http://treecraft.in/ Code fix pointed out by CypherX Thanks, Thomas Edwards
Hi there, I'm like one of those grammar Nazis, but with code! You should use the MySQLi PHP extension. In the SQL query, swap the asterisk (*) with 'playername' (without the quotes) for maximum performance. There's no need to grab all fields if you'll only be using the playername field. Anyway, good job.
Thanks for letting me in on the Query fix also, May i ask for xAuth is it possible to get if a player is online and how? The aXuth URL feature has no docs from what i can find :|
And you're using mysql_fetch_array, use mysql_fetch_assoc instant. assoc is much faster then array. If you wanna know if the player is online, use the new function in Minecraft (1.7). Query.
Something i threw together for my server real fast, it takes logblock info and displays in on a table. Includes the player, online time, blocks broke/placed Note: this is deff not the best way to do this and is very slow (selecting the block data for each user needs to be redone) , i just threw this together for my own purposes. Example http://jakebingram.gsv.me/playerstats/ Code:PHP <?php include 'db_con.php'; $sort = $_GET['sort'];if(!isset($sort)){ $sort = "playerid"; }$page = $_GET['page'];$start = $page * 20;$result = mysql_query("SELECT * FROM `lb-players` ORDER BY $sort DESC LIMIT $start,20 "); } echo mysql_error();echo 'Stats are from March 3rd 2012. Block stats are from the main world only';echo '<center><table border="1"><tr><td>#</td><td><a href="index.php?sort=playerid"> ID</a></td><td><a href="index.php?sort=playername">Player Name<a/></td><td><a href="index.php?sort=onlinetime">Online Time (sec)</td><td>Blocks Placed</td><td>Blocks Destroyed</td></tr>';$page++;$id = $start;while($row = mysql_fetch_array($result)){ $pid = $row['playerid']; $r = mysql_query("SELECT * FROM `lb-world` WHERE playerid=$pid AND type=0 "); echo mysql_error(); $r2 = mysql_query("SELECT * FROM `lb-world` WHERE playerid=$pid AND type<>0 "); echo '<tr>'; echo '<td>',$id, '</td>'; echo '<td>',$row['playerid'],'</td>'; echo '<td>',$row['playername'], '</td>'; echo '<td>',$row['onlinetime'], '</td>'; echo '<td>',mysql_num_rows($r2), '</td>'; echo '<td>',mysql_num_rows($r), '</td>'; echo '</tr>'; $id++;}//$page--;if($page>0){ echo '<a href="index.php?sort=',$sort,'&page=',$page-2,'">Prev</a> | '; }echo '<a href="index.php?sort=',$sort,'&page=',$page,'">Next</a>'; ?>