This line in select query
passcode='.sha1[$mypassword]'
$sql="SELECT * FROM
admin WHERE username='$myusername'
AND passcode='.sha1[$mypassword]' ";
should be
$sql="SELECT * FROM
admin WHERE username='$myusername'
AND passcode='".sha1($mypassword)."'";
UPDATE
The problem appears to be while saving the password the field was set to varchar(30) sha1() will return string longer than that. so that needs to be increased. And the password needs to be re-inserted since old passwords will not work.
Now
$myusername=addslashes($_POST['username']);
$mypassword=addslashes($_POST['password']);
Should be replaced as
$myusername=mysql_real_escape_string(trim($_POST['username']));
$mypassword=mysql_real_escape_string(trim($_POST['password']));
The query is already mentioned above.
And if there are more that one user with the same username and password then the condition
if($count==1)
will fail