Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-21-2010, 01:47 PM   #1 (permalink)
Registered Member
 
ataranlen's Avatar
 
Join Date: Jun 2009
Location: Flower Mound, Texas
Age: 22
Posts: 66
Default Question about global high scores

I've written some Objective-C code to load some php code and access a mysql database on a remote server.
I don't remember how to make it impossible to submit a score using the PHP page without doing it from the game. I thought I had seen something about it on these forums:

Quote:
Originally Posted by smasher View Post
True. Real encryption is out of the question, unless you want to deal with export restrictions (remember that question in the app upload screen about encryption?) But there are plenty of things you can do to increase security.

Just brainstorming:

(1) send a md5 hash if the name and score (plus a salt) along with the data, and check that hash on the server. if it doesn't match, don't post the score. That will defeat the casual cheater with a packet sniffer from creating random URLs.

(2) If you detect an attempt to post a fake score, allow it to be posted - but flag the record internally as a fake. Then remove it a random number of minutes later. Then disallow more entries from the IP. It'll be harder for a cracker to tell if their hack is working without immediate feedback.
Any suggestions on actually doing this?

I've seen the same MD5 generation code on several other websites, but I don't know how to read this in my PHP code.

The game sends the following data: Initials, Score, Country, DeviceID

Code:
This is goes in a header file:

@interface NSString (md5)
	
+ (NSString *) md5:(NSString *)str;
	
@end
And this goes in a source file:
#import <CommonCrypto/CommonDigest.h>

@implementation NSString (md5)

+ (NSString *) md5:(NSString *)str {
	const char *cStr = [str UTF8String];
	unsigned char result[16];
	CC_MD5( cStr, strlen(cStr), result );
	return [NSString stringWithFormat:
		@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
		result[0], result[1], result[2], result[3], 
		result[4], result[5], result[6], result[7],
		result[8], result[9], result[10], result[11],
		result[12], result[13], result[14], result[15]
		];	
}

@end
Thanks
__________________
Nathan Stoltenberg
Lead Programmer - Fractal Fox Studios
Mobile Applications Consultant - The Principal Consulting

Apps I've coded:
Greeble, Cat Juggling, and Garden 2 Go

1CJd8W6JiGKEgKHYp4PvWXWsnemHd8uqr7

Last edited by ataranlen; 03-21-2010 at 02:08 PM.
ataranlen is offline   Reply With Quote
Reply

Bookmarks

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



» Advertisements
» Online Users: 262
23 members and 239 guests
ADY, AragornSG, bookesp, chillyh, dacapo, Dani77, Davey555, Desert Diva, Dominus, glenn_sayers, HemiMG, JasonR, LEARN2MAKE, M.A.S., marshusensei, mer10, nobre84, Oral B, prchn4christ, Raggou, Rudy, themathminister
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,765
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:30 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0