<?php
session_start();
include("connect.php");
$match = "select id from $table where username = '".$_POST['username']."'
and password = '".$_POST['password']."';";
$qry = mysql_query($match)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);
if ($num_rows <= 0) {
echo "Sorry, $username might not be register or password entered incorrect.<br>";
echo "<a href=login.html>Try again</a>";
exit;
} else
{
session_register('username');
$site_name = $session_register;
echo "Login Successful<br>";
echo "Continue to the <a href=member.php>members</a> section.";
}
?>
I've tried to use session with this simple code when pass to the member page i try to echo it out like this
<?php
session_start();
echo hello $site_name ;
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>Members Area Welcome! </p>
</body>
</html>
I get an error on the second line of echo hello $site_name ;
is there anything wrong it?Thanks~
php session, need guidance
Feb 1 2006, 04:44 PM, updated 20y ago
Quote
0.0161sec
1.47
5 queries
GZIP Disabled