I am new to PHP so I would appreciate your patience but have been using asp/asp.net for about 10 years so I do have a good grasp of concepts.
This is the code which checks the username and password and tries to create the session variable:
Code: Select all
<?
include "connections.php";
include "queries.php";
$dbcnx2;
$info = mysql_fetch_array( $login );
$rows = mysql_num_rows($login);
if ($rows == 0)
header("Location: login.php");
else
{
session_start();
$_session['uname'] = $info['uname'];
header("Location: admin.php");
}
?>Code: Select all
<?
session_start();
if($_session['uname'] == "")
header("Location: login.php");
else
echo "Welcome " . $_session['uname'];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
</body>
</html>