MadDawgX Posted February 27, 2008 Share Posted February 27, 2008 Hey, I have a flash game set up and a highscore table. I have it setup so upon completion of the game the user submits his/her score and it POSTS the data to a php file where it is added to the database. The problem is, it's not very secure. When submitted the user can refresh the page so that it adds the score again. Im also certain there are other insecurities with the system. So, I need suggestions on how I can make this as secure as possible. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/93398-need-suggestion-for-highscore/ Share on other sites More sharing options...
Psycho Posted February 27, 2008 Share Posted February 27, 2008 I would suggest generating a random GUID that gets populated into a hidden field on the page that POSTs the data. Then when iserting the High Score also isert the GUID. You can then check if the GUID exists before inserting a new high score. Quote Link to comment https://forums.phpfreaks.com/topic/93398-need-suggestion-for-highscore/#findComment-478467 Share on other sites More sharing options...
PHP Monkeh Posted February 27, 2008 Share Posted February 27, 2008 Instead of outputting data with your submission page, you could just use it to submit the score, then forward the user to a "Thanks for submitting your score" page or whatever page you like. So have your page like this: // Submit the high-score to the database header("Location: thanks.php"); This way when the user hits refresh it'll be refreshing thanks.php, which isn't submitting anything. Quote Link to comment https://forums.phpfreaks.com/topic/93398-need-suggestion-for-highscore/#findComment-478471 Share on other sites More sharing options...
monkeymade Posted February 27, 2008 Share Posted February 27, 2008 just a thought, I don't know if this is possible the way you have the rest of your page set up, but instead of using POST or GET to send the score to the page that enters it into the high score page, use sessions. Then after the score has been added, clear that session variable out, so if refresh is hit, the score stored in the session variable is 0 instead of their actual score. Just an idea, hope you get something that works for you. Quote Link to comment https://forums.phpfreaks.com/topic/93398-need-suggestion-for-highscore/#findComment-478473 Share on other sites More sharing options...
MadDawgX Posted February 28, 2008 Author Share Posted February 28, 2008 Instead of outputting data with your submission page, you could just use it to submit the score, then forward the user to a "Thanks for submitting your score" page or whatever page you like. So have your page like this: // Submit the high-score to the database header("Location: thanks.php"); This way when the user hits refresh it'll be refreshing thanks.php, which isn't submitting anything. Okay that will work. Another thing, Im not sure about the securities of flash, but what if someone was able to get ahold of the link to the submitting page. Would they be able to manipulate a score? If so is there a way to prevent that? Quote Link to comment https://forums.phpfreaks.com/topic/93398-need-suggestion-for-highscore/#findComment-479483 Share on other sites More sharing options...
PHP Monkeh Posted February 28, 2008 Share Posted February 28, 2008 Is it possible to set hidden fields within flash? You could add a hidden field with the value "fromFlash" or something similar. Then on your process page make sure that the value from that field is "fromFlash", then you'd know that they've come from the flash page, and it would be safe to upload the high-score. I don't really know a lot about flash to give you a better answer, sessions would've been ideal. Quote Link to comment https://forums.phpfreaks.com/topic/93398-need-suggestion-for-highscore/#findComment-479515 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.