Download Horizon :: Staff Members :: TheTechGame.com :: XboxMB YouTube


Old 02-06-2012   #1 (permalink)
Mr. Noob

Dave's Avatar
Future Web Developer
Join Date: Sep 2010
Posts: 2,573
Thanks: 1,713
Default XboxMB Parse API

Well I have had some people ask how I parse the XboxMB API and get it to work without having the put a username in. You need to be added to Cheaters whitelist for it to work with this method. Big thanks for Austin for helping me with a bit of PDO. For this I created a Database in MySQL which has the UserGroup ID as the primary key and then has columns for the other data like username.



Then to use it just do;
PHP Code:
echo $UserInfo->Username."has ".$UserInfo->Posts."posts."
It will then display;
PHP Code:
Dave has 2,170 posts 
__________________


"It is hard to fail, but it is worse never to have tried to succeed. We are all inventors, each departure on a guided journey of discovery, each with a private chart, of which there is no duplicate. The world is all gates, all opportunities."



Last edited by Dave; 02-06-2012 at 12:02 PM.
Dave is offline
Reply With Quote
The following users thanked this post: Cheater912, imnotanoob, Influence, SPEED, Uzi, XIII, zombieanator


Old 02-06-2012   #2 (permalink)
imnotanoob's Avatar
Join Date: Nov 2010
Posts: 201
Thanks: 45
Default Re: XboxMB Parse API

Awesome stuff as usual daveyy
imnotanoob is offline
Reply With Quote


Old 02-06-2012   #3 (permalink)
Regular Member
sgt frankieboy's Avatar
Join Date: Nov 2010
Location: Netherlands
Posts: 2,391
Thanks: 1,738
Default Re: XboxMB Parse API

Nice, but why are you storing the data inside a database? Just for learning I guess?
__________________


Minecraft World Editor - [BETA] YTMP
Programming Resources

Quote:
Originally Posted by Rich Cook
Programming today is a race between software engineers striving to build bigger and better
idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
sgt frankieboy is online now Send a message via ICQ to sgt frankieboy Send a message via AIM to sgt frankieboy Send a message via MSN to sgt frankieboy Send a message via Yahoo to sgt frankieboy Send a message via Skype™ to sgt frankieboy
Reply With Quote


Old 02-06-2012   #4 (permalink)
Cheater912's Avatar
:D
Join Date: Jul 2010
Location: New York
Posts: 5,683
Thanks: 12,225
Default Re: XboxMB Parse API

I would bind the UserID value to a prepared statement instead of adding it to the query. It defeats the purpose of using PDO.

Code:
$sth = $dbh->prepare('SELECT * FROM users WHERE UserID = :UserID')->execute(array(':UserID', $result['UserID']));

It's a good habit to get in to because it completely eliminates SQL injection. Even though the user ID is coming from XboxMB, you never know what may happen.

You can also use this:
XboxMB API Class

Just add this to the RequestMode class:
Code:
const IP = 'ip';

Nice tut
__________________
Cheater912 is offline Send a message via Skype™ to Cheater912
Reply With Quote
The following users thanked this post: Austin, Dave


Old 02-06-2012   #5 (permalink)
Mr. Noob

Dave's Avatar
Future Web Developer
Join Date: Sep 2010
Posts: 2,573
Thanks: 1,713
Default Re: XboxMB Parse API

Quote:
Originally Posted by Cheater912 View Post
I would bind the UserID value to a prepared statement instead of adding it to the query. It defeats the purpose of using PDO.

Code:
$sth = $dbh->prepare('SELECT * FROM users WHERE UserID = :UserID')->execute(array(':UserID', $result['UserID']));

It's a good habit to get in to because it completely eliminates SQL injection. Even though the user ID is coming from XboxMB, you never know what may happen.

You can also use this:
XboxMB API Class

Just add this to the RequestMode class:
Code:
const IP = 'ip';

Nice tut
Yeah I used to use something like that but Austin said it wasn't good for server to keep being parsed every time for everything so he told me to create DB to store it in. Thanks for the tip I will add it now.
__________________


"It is hard to fail, but it is worse never to have tried to succeed. We are all inventors, each departure on a guided journey of discovery, each with a private chart, of which there is no duplicate. The world is all gates, all opportunities."


Dave is offline
Reply With Quote




Old 02-06-2012   #6 (permalink)
Regular Member
sgt frankieboy's Avatar
Join Date: Nov 2010
Location: Netherlands
Posts: 2,391
Thanks: 1,738
Default Re: XboxMB Parse API

Quote:
Originally Posted by Dave View Post
Yeah I used to use something like that but Austin said it wasn't good for server to keep being parsed every time for everything so he told me to create DB to store it in. Thanks for the tip I will add it now.
That also explained my question of why adding it to a database
__________________


Minecraft World Editor - [BETA] YTMP
Programming Resources

Quote:
Originally Posted by Rich Cook
Programming today is a race between software engineers striving to build bigger and better
idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
sgt frankieboy is online now Send a message via ICQ to sgt frankieboy Send a message via AIM to sgt frankieboy Send a message via MSN to sgt frankieboy Send a message via Yahoo to sgt frankieboy Send a message via Skype™ to sgt frankieboy
Reply With Quote


Old 02-06-2012   #7 (permalink)
Mr. Noob

Dave's Avatar
Future Web Developer
Join Date: Sep 2010
Posts: 2,573
Thanks: 1,713
Default Re: XboxMB Parse API

Quote:
Originally Posted by sgt frankieboy View Post
That also explained my question of why adding it to a database
Just noticed your question. Sorry for missing you. I also find it easier to use it from DB as it's an array.
__________________


"It is hard to fail, but it is worse never to have tried to succeed. We are all inventors, each departure on a guided journey of discovery, each with a private chart, of which there is no duplicate. The world is all gates, all opportunities."


Dave is offline
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:34 AM.


 

Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
COPYRIGHT (c) 2010 - 2012 - XboxMB - DESIGN BY:
EDENWEBS.COM