Possible problems:
- SQL injection
- XSS Injection (if this code was an insert request, that would be a definite problem)
- Plain text password
Your SQL statement may be problematic. It’s bad practice to leave yourself open for SQL injection.
SQL Injection Error . Believe me.
If you want to display $ user on an HTML page, you may not want to enable the ability to “hack” your layout by typing commands, for example
<H1>HI MOM</H1>
or a bunch of javascript .
, ( cagcowboy!). , ( ) . .
:
function MakeSafe($unsafestring)
{
$unsafestring= htmlentities($unsafestring, ENT_QUOTES);
if (get_magic_quotes_gpc())
{
$unsafestring= stripslashes($unsafestring);
}
$unsafestring= mysql_real_escape_string(trim($unsafestring));
$unsafestring= strip_tags($unsafestring);
$unsafestring= str_replace("\r\n", "", $unsafestring);
return $unsafestring;
}
$name = MakeSafe( $_POST["user"] );
$pwd = MakeSafe( $_POST["pwd"] );
$pwd = base64_encode(pack("H*",sha1($pwd)))