Q:

mysql num rows is failing

$result=mysql_query("SELECT * FROM users WHERE pass='".sha1($_POST['mainloginpass'])."'"); 

if(mysql_num_rows($result)==1){

it says that "mysql_num_rows() expects parameter 1 to be resource, boolean given"

A:

mysql_query normally returns a resource, but according to the docs:
mysql_query() will return FALSE on error and also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query. 
You may want to try something like this:
if (! $result) {
    die('Invalid query: ' .  mysql_error());
}

To see what the problem is.