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";
}
?>