You need to do a check at the start of any access-controlled page to see if the desired session value is set.
On a related note, I see that your login code is using the deprecated session_register() function. To get your code into the 21st century, you should be using the $SESSION array, instead.
if($count==1){
$_SESSION["username"] = $username;
session_write_close(); // make sure session data is saved before redirect
header("location:admin_index.php");
exit; // make sure no more code is executed here
}
(Note that I did not save the password to the session data, as it's not needed for checking login status and saving it in the session data reduces your password security.)
Then in the admin page:
<?php // this must be the first line with no space/newline before it
session_start();
if(empty($_SESSION['username']))
{
include 'path/to/login_form_page.php';
exit; // don't execute rest of this page
}
// rest of admin page...
?>