Start with wrapping the fields in your query like so:
$searchusr="SELECT user_name, user_pass " .
"FROM userinfo " .
"WHERE user_name='" . mysql_real_escape_string(substr($username,0,128)) . "' " .
"AND user_pass='" . mysql_real_escape_string(substr($password,0,128)) . "'";
Never ever ever pass unchecked variables into a database query. It's too easy for someone to set there username to this:
"; update userinfo set password = 'whateverIwant' where username = "admin
and then just totally trash your stuff. All an attacker would need is 5 minutes and a list of usernames to pull a very clean takeover.
Besides that, what do you think is wrong with it?