PDA

View Full Version : My Microsoft Points Converter


bigsteveouk
June 28th, 2006, 23:05
Hi guys,

I have been playing with learning PHP and thought i would make a little converter that changes MSP (Microsoft Points) into these currencies.

USD, EURO, GBP, CAD, AUD, JPY, NOK & CHF

Check it out: http://www.mspconverter.com/

Thanks

bigsteveouk

EDIT: Added JPY, NOK & CHF
EDIT2: Changed to new URL

Studley
June 28th, 2006, 23:36
Well I'm a web developer and a tester for a living so I can give you a few little tips :thup: Nothing important, it certainly works.

#1: It's not displaying the correct number of decimal places for currencies; i.e. if the price is £12.40 then it displays £12.4. There are two ways you can deal with this; either convert the original number to two decimal places before displaying it, or do a check to see if it's only got one character after the "." symbol, and if so then pad a 0 on the end. As you're still learning PHP, I'll do the "cruel to be kind" thing and leave you to find out how to do it yourself - you'll learn more by trial and error ;) First way is definitely easiest.

#2: Yeah, I got sneaky and looked in your code. Can't you get Yen to work? Why did you comment it out? If you don't want it to even appear in your code, use PHP comment tags rather than HTML comment tags, and it won't even be outputted to the code. PHP comment tags are definitely safer because then sneaky people like me can't see stuff that they shouldn't!

#3: You've got just the one form input field (MSP) but you're not validating it; you should really make it so that it only accepts numbers, and if you put anything else in then it displays a popup error message "Please enter a numeric value for MSP" or something. On the plus side it doesn't crash if you put a non-numeric value in... was that just luck? ;)

Sorry for being VERY picky, it's my job! But as first PHP projects go, it's a great start. Heck it works, I couldn't break it as such, which is better than most of the projects that I put together myself... Good luck in your future work :Y)

Cage
June 28th, 2006, 23:51
Only one comment. Why isn't xboxic.com on the "Links to cool websites" page? :+
Other then that (and the decimal and jpy problem), great work for a first project _o_

bigsteveouk
June 29th, 2006, 00:06
Cheers for the advice guys. Im working on the Yen as we speak! :)
I will have a look at adding the extra 0 to the end when needed.

Also, I have added xboxic to the links page :)

Rival24
June 29th, 2006, 00:16
Oh and before Curry begins whining about it: W3C (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.stevehunter.co.uk%2F) thingy

bigsteveouk
June 29th, 2006, 00:18
Oh and before Curry begins whining about it: W3C (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.stevehunter.co.uk%2F) thingy

Hehe... not too worried about that :P It's more to learn this damn php :)

bigsteveouk
June 29th, 2006, 00:35
fixed the lack of the extra zero with the money_format converter

TRIGGER M4N
June 29th, 2006, 00:39
Ok, I'm not a maths-magician, but if I type 1 MS point, it says that = 1 pence, I type 34 in and it converts to 28 pence, can you explain that? Shouldn't it be 34 pence?

Other than that, that site is actually really neat, and I've learned from it immediatly.

Rival24
June 29th, 2006, 00:46
Ok, I'm not a maths-magician, but if I type 1 MS point, it says that = 1 pence, I type 34 in and it converts to 28 pence, can you explain that? Shouldn't it be 34 pence?

Other than that, that site is actually really neat, and I've learned from it immediatly.
My guess is that it's rounded off.

TRIGGER M4N
June 29th, 2006, 00:48
Yeah, I can be a bit weird like this, but he asked for feedback, and that's the only flaw I could find.

aries
June 29th, 2006, 00:59
honestly, i think u did a good job. but on the canadian funds, u are about 60 cents off. its actually 19.99 for a card that gives u 1250 points. i know its nitpicking, but i just thought id be honest. but good job with that. i could never do it lol.

bigsteveouk
June 29th, 2006, 01:02
honestly, i think u did a good job. but on the canadian funds, u are about 60 cents off. its actually 19.99 for a card that gives u 1250 points. i know its nitpicking, but i just thought id be honest. but good job with that. i could never do it lol.

I was working off a conversion of 1MSP = 1.55CAD. So it should be 1.59 or 1.60 per msp? Please let me know

bigsteveouk
June 29th, 2006, 01:05
Ok, I'm not a maths-magician, but if I type 1 MS point, it says that = 1 pence, I type 34 in and it converts to 28 pence, can you explain that? Shouldn't it be 34 pence?

Other than that, that site is actually really neat, and I've learned from it immediatly.

Ok, i think i have fixed that now. Can you tell me if it's ok?

Curry
June 29th, 2006, 03:14
Hi guys,

I have been playing with learning PHP and thought i would make a little converter that changes MSP (Microsoft Points) into these currencies.

USD, EURO, GBP, CAD & AUD

Check it out on my domain. http://www.stevehunter.co.uk/

As I say, i am still learning, but any feedback or suggestions would be appreciated.

Thanks

bigsteveouk Looks and functions good :) As Rival24 predicted, I will be bitching about validation (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.stevehunter.co.uk%2F) (had that link on my clipboard before I read his post :+ ) "I'm just learning this stuff" isn't an excuse, writing valid HTML is a prerequisite for learning PHP. After all, all PHP does it outputting HTML, so you'd better get the HTML completely covered before you start doing something that generates HTML. Sounds harshes than I mean it ;) Validation errors are no worldshocking disaster, but you should always try to run the validator regularly during development. And about "I'm just learning": are you allowed to drive off the roadway during driving lessons because you are just learning? No, you're bound to basic traffic rules. Similarly, web development is bound by basic traffic rules, in this case those laid out by the World Wide Web Consortium or W3C. Follow their rules, you'll learn to appreciate it :)

And please ask anything you want to know, I know a lot of PHP and HTML and I'm more than willing to help with whatever you want to know. Especially now you've added that link ;)

bigsteveouk
June 29th, 2006, 11:10
Cheers Curry, I will add a load of CSS and clean it up tonight. It's not looking the same in IE as it does in FF so need to work on that.

EDIT: All HTML Valid now :)

Studley
June 29th, 2006, 13:21
EDIT: All HTML Valid now :)

You're one step ahead of Xboxic (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.xboxic.com%2F) then ;)

Seems that speech marks and apostrophes cause some major confusion...

Curry
June 29th, 2006, 14:13
You're one step ahead of Xboxic (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.xboxic.com%2F) then ;)

Seems that speech marks and apostrophes cause some major confusion...Hmm nice bug, missing a call to htmlentities there in constructing the trackers :) Will fix tonight if I find time :)

YLA G
June 29th, 2006, 14:16
don't forget the corrupt div :p

swoosh bnd
June 29th, 2006, 21:38
I found that if you put more than 316 9's in it, its calculations become really messed up ;). Other than that it's a really cool tool.

Curry
June 30th, 2006, 02:22
I found that if you put more than 316 9's in it, its calculations become really messed up ;). Other than that it's a really cool tool.You should apply for a job as Quality Assurance manager somewhere :D

swoosh bnd
June 30th, 2006, 09:03
You should apply for a job as Quality Assurance manager somewhere :D

I think I made a mistake, it was more than 308 when the error occurred. The USD will always be at $115246033600500432.00 however many you add beyond that. :)

Curry
June 30th, 2006, 09:58
I think I made a mistake, it was more than 308 when the error occurred. The USD will always be at $115246033600500432.00 however many you add beyond that. :)Hmm that's a surprising amount actually, I was expecting 2 to the power of 31 or 63 :P Hint for bigsteve: always validate your inputs, never expect the user to follow your intended logic. Just fail for numbers of more than 10 digits or something :) That way you can also avoid situations like this:

53abc http://www.stevehunter.co.uk/images/msp_small.gif Microsoft Points is:
USD http://www.stevehunter.co.uk/cflags/us.png 66.22 Cents
GBP http://www.stevehunter.co.uk/cflags/uk.png 45.05 Pence
EURO http://www.stevehunter.co.uk/cflags/ck.png 61.64 Cents
CAD http://www.stevehunter.co.uk/cflags/ca.png 84.75 Cents
AUD http://www.stevehunter.co.uk/cflags/au.png 87.45 Cents
JPY http://www.stevehunter.co.uk/cflags/jp.png ¥78.44preg_match("[0-9]{1,10}") would solve most problems :)

bigsteveouk
July 4th, 2006, 21:20
Just wanted to say thanks to everyone for the tips etc. I will continue to develop the points converter. Hello to the people who send messages to my xbox too.

| V |
July 5th, 2006, 12:43
Not to be a negative nancy but you actually come round to buying MS points dont you have to buy them in clumpos of like 400,800 etc?

And the program is very nice btw :)

bigsteveouk
July 5th, 2006, 13:27
Not to be a negative nancy but you actually come round to buying MS points dont you have to buy them in clumpos of like 400,800 etc?

And the program is very nice btw :)

This is true. But the reason I have made it flexible is that the content on marketplace is different prices. Example: A picture pack might be 80MSP. Or say you have 220 points left and your wondering how much is that worth?

xboxguy
July 5th, 2006, 18:26
very cool.

| V |
July 5th, 2006, 20:12
This is true. But the reason I have made it flexible is that the content on marketplace is different prices. Example: A picture pack might be 80MSP. Or say you have 220 points left and your wondering how much is that worth?

Now you've explained why you made it i can see how useful it is for that purpose :)

cybermans
July 6th, 2006, 10:59
now some cool overlib (http://www.bosrup.com/web/overlib/?Features) like thingie and we can use it on the front page :P

kidkit
July 6th, 2006, 22:18
Uh Oh, you've been spotted by the mega web.. Expect some traffic on your webspace.


Bigsteveouk created a handy tool that will let you type in an MS points amount and it will spit back what those points cost in various global currencies. This can be handy if you need to stick to a budget the next time you want to purchase some horse armor.

Thanks to everyone that sent me the link to this tool.

Posted: Thursday, July 06, 2006 10:42 AM by Major Nelson
Filed under: Xbox Live


http://www.majornelson.com/archive/2006/07/06/MS-Points-Converter.aspx

Curry
July 6th, 2006, 23:03
Lol gratz :) Your host and bandwidth surviving it?

kidkit
July 6th, 2006, 23:43
Joystiq is on to you now as well duder..

http://www.joystiq.com/2006/07/06/bad-at-math-use-this-ms-points-converter/

Quite the attention you're getting for a quick PHP fun project :D

Nino
July 7th, 2006, 00:56
Wow that's awesome, congrats!

Curry
July 7th, 2006, 01:16
And 360FB (http://www.xbox360fanboy.com/2006/07/06/ms-points-currency-converter/) and K1lla's (http://thrillskilla.wordpress.com/2006/07/05/ms-points-converter/) :D

bigsteveouk
July 7th, 2006, 02:05
This is nuts.

4500 hits today alone! Got friends requests coming out of my ears.

Curry
July 7th, 2006, 02:10
This is nuts.

4500 hits today alone!
Hehe not even close to Xboxic yet then ;) If your hosting should become a problem, do drop me a line I can put it on our servers if need be.

bigsteveouk
July 7th, 2006, 02:32
Lol gratz :) Your host and bandwidth surviving it?

Just been checking my webstats, its all looking smooth at the min :s My hosting company will prob pull me though :)

Curry
July 7th, 2006, 02:35
Just been checking my webstats, its all looking smooth at the min :s My hosting company will prob pull me though :)
Good, as long as they don't charge you per MB traffic, that's what I was worrying about :)

Ponder416
July 7th, 2006, 19:31
Congrats on the your new popularity (http://www.majornelson.com/archive/2006/07/06/MS-Points-Converter.aspx#comments)

bigsteveouk
July 8th, 2006, 20:18
I had to put some ads on there. my monthly bandwidth is already up and I had to order some more. Spoke to Major Nelson via email and he is gonna mention it on the show too. Curry, how come xboxic didnt run the story? :'(

TRIGGER M4N
July 8th, 2006, 23:04
When new content appears on your xbox 360 i will update the 10 most recent list.
Happy Gaming!

Whoa, dude, you forgot to make that a capital I.

bigsteveouk
July 9th, 2006, 20:00
Whoa, dude, you forgot to make that a capital I.

Opps....! Sorted

Curry
July 10th, 2006, 01:37
I had to put some ads on there. my monthly bandwidth is already up and I had to order some more. Spoke to Major Nelson via email and he is gonna mention it on the show too. Curry, how come xboxic didnt run the story? :'(Uhm well it's on our forum, and it's technically not really 'news' is it? 8)7 ;)

I will gladly put the site without ads up on mspc.xboxic.com if you want to save on the bandwidth? You could just pop a redirect on the current address. A few gigabytes more aren't going to kill us (as long as you keep it under 1TB per month I foresee no probs :+ ). Pop me a priv if need be.

Lord d'Eath
July 10th, 2006, 13:06
Looks like your site's collapsed, dude. :(

preg_match("[0-9]{1,10}") would solve most problems :)
While technically correct, regular expressions use a lot of CPU time so I try to avoid them if possible. A call to is_numeric and strlen would do the job, too, and probably faster.

Another trick for only accepting numeric inputs and such is to just add 0 to any user inputs before handling them, i.e.
$_GET['SomeField']+=0;
PHP's loose typing is useful for stuff like that ;) It's generally only a useful trick for inserting into databases, though. If you're performing mathematical functions on it anyway you probably won't run into problems, but if you're adding it to a database query invalid inputs can cause problems ranging from a failed query to SQL injection exploits.

Anyway, congrats on that unexpected popularity ;)

Edit: Okay so during the time it took me to register and post that your site came back... Bah! Way to make me look like a liar! ;)

Curry
July 10th, 2006, 15:22
While technically correct, regular expressions use a lot of CPU time so I try to avoid them if possible. A call to is_numeric and strlen would do the job, too, and probably faster.
Absolutely correct as well, I just don't foresee CPU time becoming a problem for this single script :) In the code of this site, where we have had situations of CPU overload, I'm more performance-oriented ;)

Another trick for only accepting numeric inputs and such is to just add 0 to any user inputs before handling them, i.e.
$_GET['SomeField']+=0; PHP's loose typing is useful for stuff like that ;)
With PHP's tendency to break obscure behaviour consequently between every major version, I certainly wouldn't count on vague tricks like this and just perform proper input validation like the 2 solutions you and I mentioned before.

And welcome to the forum :)

Lord d'Eath
July 10th, 2006, 15:26
With PHP's tendency to break obscure behaviour consequently between every major version, I certainly wouldn't count on vague tricks like this and just perform proper input validation like the 2 solutions you and I mentioned before.
Heh, yeah, I certainly wasn't suggesting that it's good style or anything, but it's absolutely perfect compared to a lot of things that PHP lets people get away with (turn off error reporting and let PHP do its "I think you probably meant <this>" behaviour and you get some really shoddy code ;) - paFileDB is a prime example ;)).

YLA G
July 10th, 2006, 16:14
bigsteveouk (http://forum.xboxic.com/member.php?u=123) vbmenu_register("postmenu_9419", true);
did you see my pm from last week?

YLA G
July 10th, 2006, 16:14
hmm? bug if you copy paste a nickname

Curry
July 10th, 2006, 16:21
hmm? bug if you copy paste a nickname
Actually correct browser behaviour which turns out strange in the intelligent text box :)

bigsteveouk
July 14th, 2006, 09:43
Well a week on guys and my stevehunter domain nearly died under the pressure. I have decided to get the converter its own domain name. http://www.mspconverter.com and a bit of a better suited hosting package. :)

Chris
July 14th, 2006, 10:12
Lookin' good, but you took your gamertag away from the site. :(

Get tired of 300 messages/requests a day?

bigsteveouk
July 14th, 2006, 10:36
I left it in the About page. But yep, 20/30 messages a day and a ton of FR.

Curry
July 14th, 2006, 11:56
Well a week on guys and my stevehunter domain nearly died under the pressure. I have decided to get the converter its own domain name. http://www.mspconverter.com and a bit of a better suited hosting package. :)Told you :P

Now go register with Adsense and make some pennies out of it :)

YLA G
July 14th, 2006, 17:33
steve are you ignoring me?

bigsteveouk
July 14th, 2006, 17:42
steve are you ignoring me?

Sorry dude, I only just noticed the unread PM. I will reply in a bit.

bigsteveouk
July 14th, 2006, 21:33
Check out the site. I have just uploaded my MSP Converter for Windows. Be sure to check it out and give me feedback.

http://www.mspconverter.com/images/winapp2.jpg

Curry
July 15th, 2006, 01:16
Nice job dude, really milking it aren't ya :P

cybermans
July 17th, 2006, 18:15
it looks on the screenie you used the pound symbol for a lot of currencies. What did you use anyway? local conversion or webservices?

Rival24
July 18th, 2006, 02:07
I had to put some ads on there. my monthly bandwidth is already up and I had to order some more. Spoke to Major Nelson via email and he is gonna mention it on the show too. Curry, how come xboxic didnt run the story? :'(
I mentioned it in a frontpage (http://www.xboxic.com/news/1287) post ;)

Sir SpankalotUK
July 18th, 2006, 14:59
just curious as to why theres USD appearing after the pound sign, and a few other of the top currencies.

bigsteveouk
July 18th, 2006, 17:57
just curious as to why theres USD appearing after the pound sign, and a few other of the top currencies.

Bah... something has guffed up in my code. Will take a look.

Is it totally boiling hot where everyone else is too? Im melting here!

Curry
July 18th, 2006, 18:02
34 degrees in southeast Netherlands here.

TRIGGER M4N
July 18th, 2006, 18:53
33°C here in the Midlands of the UK.

Cage
July 18th, 2006, 19:12
37 degrees here in the 'real' south of the Netherlands. I think tomorrow we'll pass the threshold of 40 degrees.. Smokin'!

bigsteveouk
July 19th, 2006, 12:15
I just heard is gonna be the hottest July day on record in the UK and my aircon unit in work packed in yesterday ! NOOOOOOOOO!!!!

Curry
July 20th, 2006, 02:02
You're screwed :P Meanwhile, we hit 36 today, and I work @ home on Wednesdays and Thursdays, and I have no airco either at home, so I'm also screwed ;)

TRIGGER M4N
July 20th, 2006, 02:33
Leicester (from which I live in) has been about 36 degrees celcious today, and tomorrow is slated for 26 D.celcius. So screw you guys.

cybermans
July 20th, 2006, 08:50
we have an airco at work, but when 5 people are in the same room the airco can't keep up. But shall we go back ontopic now?

Pedle Zelnip
July 30th, 2006, 21:23
Check out the site. I have just uploaded my MSP Converter for Windows. Be sure to check it out and give me feedback.

http://www.mspconverter.com/images/winapp2.jpg

Am I missing something, I can't find the converter for Windows anywhere on the site....

Curry
July 31st, 2006, 11:54
You're not the only one missing something there :)

Studley
August 3rd, 2006, 20:44
So I just bought this month's Official Xbox Magazine UK (more about that later), I turned to page 31, and guess what I found? An article about the Microsoft Points Converter 8)

Because they're complete amateurs though, they split the web address across two lines of the article, like this:


visit www.stevehunter.co.uk/results.
php and type in the number...

So if you've got domain-level access, I'd suggest creating a subfolder called results which redirects to your new site, so anybody who mistakenly types in www.stevehunter.co.uk/results gets to your site.

Curry
August 4th, 2006, 03:33
RewriteEngine on
RewriteBase /
RewriteRule ^/results$ /results.php Would be the proper way ;)

Studley
August 4th, 2006, 18:23
It certainly would, if Steve has better Apache access than my paranoid webhosts allow :P

bigsteveouk
August 11th, 2006, 03:51
Thanks for the heads up Studley.

I have sorted out the /results page.

I don't know if any of you guys have revisited but i have done a complete redesign. Let me know what you think.

http://www.mspconverter.com

Thanks again

Curry
August 11th, 2006, 04:14
I did, we've actually been linking to it on our FP in Marketplace posts ;)

Sir SpankalotUK
August 11th, 2006, 15:45
you've got the actually bit that we would use hemmed in by adverts. I dont like adverts but understand why some people need them, currys done a good job of keeping the annoying beast out of the way of the content especially on the news pages.

PS- I hate adverts

Curry
August 11th, 2006, 16:04
Advertising is a necessary evil, but I've already kicked ad providers out that weren't capable of adhering to my "but it mustn't irritate anyone" standards. If the provider isn't capable of filtering excessive flashing or popups, they're not advertising on Xboxic :)

Sir SpankalotUK
August 11th, 2006, 17:12
gonna have to find the adblock extension again

Curry
August 14th, 2006, 01:23
gonna have to find the adblock extension againAs long as you don't use it on Xboxic ;)

Sir SpankalotUK
August 14th, 2006, 11:23
out of interest are you paid on click or advert views? or both?

| V |
August 14th, 2006, 14:42
:o this guy is in September's 360 magazine in the news section

Curry
August 14th, 2006, 15:39
out of interest are you paid on click or advert views? or both?
Mostly views, some clicks. Cost-per-click advertising is mainly for small sites, we use it to "fill the remnants" of our inventory.

Sir SpankalotUK
August 14th, 2006, 16:59
:o this guy is in September's 360 magazine in the news section

presume your talking about curry, because I am mr unnoticable.

Curry
August 14th, 2006, 17:16
I think he's talking about Steve, I would be mighty surprised to find myself in the mag ;)

Studley
August 14th, 2006, 17:27
:o this guy is in September's 360 magazine in the news section

You think? (http://forum.xboxic.com/showpost.php?p=11159&postcount=70) ;)

| V |
August 14th, 2006, 18:48
Haha sorry mate didnt notice, aint been here for a while and didnt check all the posts ;)

Genesis
August 20th, 2006, 03:25
http://www.mspconverter.com/results.php?MSP=%00&conversion=Convert

Pmghax? ;P

TRIGGER M4N
August 20th, 2006, 12:39
Probably exploded the server due to everyone checking the price of the Chromehounds content.

Curry
August 21st, 2006, 00:33
Probably exploded the server due to everyone checking the price of the Chromehounds content.
That would probably cause some overflows yeah :+

Studley
August 21st, 2006, 12:18
Or maybe related to his frontpage post:

UPDATE: Check out the new GooMGC 2.0 which now includes the MSP Converter

Which is great news for him, but if it's calling the same conversion routine then it's probably getting hammered now.

Genesis
August 21st, 2006, 22:24
Probably exploded the server due to everyone checking the price of the Chromehounds content.

Nah... A Null byte will cause an error for anything... :P

bigsteveouk
August 22nd, 2006, 20:55
Yep, it was a % sign in the url. use the normal url in my sig for the site.

I will put some long needed validation code in over the next few days.

Cage
August 22nd, 2006, 21:17
Hey Steve. I really like your xboxscoop site. It's the perfect site for all xbox news. *bookmark*
Great job.. _o_

bigsteveouk
August 22nd, 2006, 21:19
Hey Steve. I really like your xboxscoop site. It's the perfect site for all xbox news. *bookmark*
Great job.. _o_

No problem man, if anyone knows some good RSS feeds from other xbox websites, PM them to me.

I will be adding news features over the next few weeks.

Rival24
August 26th, 2006, 02:28
This (http://www.xboxic.com/feed/), this (http://www.xboxic.com/feed/) or perhaps this (http://www.xboxic.com/feed/) one?

CR3W
February 11th, 2007, 16:15
nice

Rival24
February 11th, 2007, 19:59
Congratulations with an incredibly useless kick!

Curry
February 11th, 2007, 21:45
/me jots down nomination for 'most useless kick of 2007' :P

Drunk Munky
February 13th, 2007, 11:24
well anyway my xbox 360 cost me 32,012 ms points