This code works online for login. I wonder it doesn't work offline for login. I am using windows 7 and apache server. I already enter the correct username and password. It shows nothing as if nothing happens.

<?php
ob_start();
include('../includes/koneksi.php');


/* the files */

// username and password sent from form
$username=$_POST['username'];
$password=$_POST['password'];

// To protect MySQL injection (more detail about MySQL injection)
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

$encrypted_password = md5($password);

$sql = "SELECT * FROM user WHERE username='$username' and password='$encrypted_password'" or die(mysql_query);
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);

echo $count; 
// If result matched $username and $password, table row must be 1 row

if ($count==1){

// Register $myusername, $mypassword and redirect to file "login_success.php"
//session_register("username");
//session_register("password");

$_SESSION['username'] = $username;
$_SESSION['password'] = $password;

header("location:admin.php");
}
else {
echo "Wrong Username or Password";
}
?>

What do you mean by offline? Are database and webserver accessible when you are offline (localhost) or are they somewhere else (accessible through internet)? Do you have php.ini set up to display errors? Do you have a ob_end_flush() command at the end?

I think you are saying about offline server on localhost. Then that won't work (e.g. setting the APACHE server to offline) it won't work

by the way he said, I think he is trying to test the code and it was working on the Internet host but not under something like xampp which is using the localhost.

if not then, the offline is really mean that he shut down the apache...

one thing I notice is you are using $_SESSION and you didnt have session_start();

my suggestion is try to comment out line 38 and put a session_start(); at the top and then put a echo $_SESSION['username']; below line 38.

Like broj1 says, if you don't have ob_end_flush() at the last line the script is just hanging, waiting for the starting gun.
And as yy886 says

comment out line 38 and put a session_start(); at the top and then put a echo $_SESSION['username']; below line 38.

don't do any redirects until you know the script is working,= basic debugging.