i also suggest cleaning up those vars a bit better
something like
Code:- $your_var = ( isset( $_POST['username'] ) && !empty( $_POST['username'] ) ) ? trim( htmlspecialchars( str_replace( array( "\r\n", "\r", "\0" ), array( "\n", "\n", '' ), $_POST['username'] ), ENT_QUOTES, 'UTF-8' ) ) : '';
Copy Code ( Yes im very paranoid when it comes to user input into my database )
Otherwise you might have issues with people putting in code in usernames.
From PHP.net
mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.
characters like ( ) | ; etc are not quoted which can lead to possible injections or errors because of user input.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO submits (susite, sudir) VALUES ('1', '41,)' at line 1
I thought this the best place to ask for help even though it's mixed with php.
I'm a complete newbie to SQL and PHP so any help would be much appreciated :-) |