homepage Welcome to WebmasterWorld Guest from 54.167.173.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP games scoring system
Seedy




msg:4427022
 3:55 pm on Mar 9, 2012 (gmt 0)

My games scoring code is returning the games' .swf file URL as the User-Agent when a blank name is entered for the score (appending it to the beginning of the real U-A). How can I prevent this happening or maybe just block blank names from being submitted please? (a simple database ban of ' ' doesn't work)

Many thanks in advance.

# Saving new score?
if (isset($player_score) && is_numeric($player_score) && isset($player_name) && strlen($player_name) > 0 && strlen($player_name) <= $name_max) {

# Is this IP banned?
$query = mysql_query('SELECT ip FROM ipban') or error_msg('Could not access database.');
while ($row = mysql_fetch_row($query))
{
$ip_check = strpos($player_ip, $row[0], 0);
if ($ip_check === 0) error_msg('Disallowed');
}
#Is this name banned?
$query = mysql_query('SELECT name FROM nameban') or error_msg('Could not access database.');
while ($row = mysql_fetch_row($query)) {
if (strstr(strtolower($player_name), $row[0])) error_msg('Disallowed');
}
# Has this name played already?
$query = mysql_query("SELECT name, score FROM $table_name") or error_msg('Could not access database.');
$num_rows = mysql_num_rows($query);
$name_found = false;
while ($row = mysql_fetch_row($query)) {
if ($player_name == $row[0]) {
$name_found = true;
break;
}
}

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved