I had already used this code 2 times, but now doesn't work and i don't know why. Below is the code from the file process_login.php. The code works fine, but when i get to admin.php can´t echo $_SESSION['USER'] and the same isn´t set. Thanks in advance.
<?php
session_start();
mysql_connect('localhost','root','root');
mysql_select_db('user_db');
$user=$_POST['user'];
$password=$_POST['password'];
$sql="SELECT * FROM users WHERE username='".$user."' AND password='".$password."'";
$res=mysql_query($sql);
if (mysql_num_rows($res)>0)
{
$row=mysql_fetch_array($res);
$_SESSION['USER']=$row['username'];
header("location: admin.php");
}
else
{
header("location: login.php");
}
?>