Hi all, I am new to php and am having trouble with a script. I *think* the problem is with start_session or register_session. Here are the two scripts that I am using.
- <?
-
include("inc/config.php");
-
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
-
$query = "SELECT * FROM clients WHERE name = '$name' AND password = PASSWORD('$password')";
-
$result = mysql_db_query($database, $query, $connection);
-
if (mysql_num_rows($result) == 1)
-
{
-
session_start();
-
-
session_register("client_id");
-
session_register("client_name");
-
session_register("client_email");
-
session_register("client_ref");
-
session_register("client_title");
-
list($clientid, $name, $pass, $email, $ref, $title) = mysql_fetch_row($result);
-
$client_id = $clientid;
-
$client_name = $name;
-
$client_email = $email;
-
$client_ref = $ref;
-
$client_title = $title;
-
-
header("Location: menu.php");
-
mysql_free_result ($result);
-
-
mysql_close($connection);
-
}
-
else
-
-
{
-
mysql_free_result ($result);
-
mysql_close($connection);
-
-
header("Location: index.htm");
-
exit;
-
}
-
?>
and this one.
I can't seem to log into the "admin" area. I know that this issue has to do with the session because in the second script where we have:
- <?
-
if ($client_name !== 'admin')
-
{
-
?>
-
<h2>Hello <b>
-
<? echo $client_name ?>
-
</b> </h2>
-
Here are your invoices:
-
-
<?
and after I log in under the admin account, I am not seeing the word "admin" echoed. Does something jump out at anyone? Thanks for looking. Frank