[ASAP] Row 36!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Thew
    New Member
    • Aug 2010
    • 69

    #1

    [ASAP] Row 36!

    Code:
    	//Function to sanitize values received from the form. Prevents SQL injection
    	function clean($str) {
    		$str = @trim($str);
    		if(get_magic_quotes_gpc()) {
    			$str = stripslashes($str);
    		}
    		return mysql_real_escape_string($str);
    	};
    	
    	//Sanitize the POST values
    	$fname = clean($_POST['fname']); // ROW 36 <=========================================
    	$lname = clean($_POST['lname']);
    	$login = clean($_POST['login']);
    	$password = clean($_POST['password']);
    	$cpassword = clean($_POST['cpassword']);
    IT doesnt work :

    Parse error: syntax error, unexpected T_STRING on row 36

    HELP!!!
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Can't see an error but you are asking for trouble because you have no error trapping or input verification whatsoever.
    You need to check POST variables are not empty() and in some cases isset().
    Also mysql_real_esca pe_string can return false and function clean() is not checking $str is a string and whether it is empty.

    Comment

    Working...