Dear all
Here is my Code in
Login Page!!!
<?php
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$KT_LoginAction = $PHP_SELF;
if ($QUERY_STRING!="") $KT_LoginAction .= "?".$QUERY_STRING;
$KT_valUsername=$user;
if (isset($KT_valUsername)) {
  $KT_fldUserAuthorization="Username";
  $KT_redirectLoginSuccess="main.php";
  $KT_redirectLoginFailed="LOGIN.php";
  $KT_rsUser_Source="SELECT Username, Password ";
  if ($KT_fldUserAuthorization != "") $KT_rsUser_Source .= "," .
$KT_fldUserAuthorization;
  $KT_rsUser_Source .= " FROM login WHERE Username='" . $KT_valUsername . "'
AND Password='" . $password . "'";
  $KT_rsUser=$Mysql_nedcorhk->Execute($KT_rsUser_Source) or
DIE($Mysql_nedcorhk->ErrorMsg());
  if ($KT_rsUser->RecordCount()==1) {
    // username and password match - this is a valid user
    $KT_Username=$KT_valUsername;
    session_register("KT_Username");
 setcookie("username",$KT_Username,time()+600);
    if ($KT_fldUserAuthorization != "") {
      $KT_UserAuthorization=$KT_rsUser->Fields($KT_fldUserAuthorization);
    } else {
      $KT_UserAuthorization="";
    }
    session_register("KT_UserAuthorization");
    if (isset($accessdenied) && false) {
      $KT_redirectLoginSuccess = $accessdenied;
    }
    $KT_rsUser->Close();
    session_register("KT_login_failed");
 $KT_login_failed = false;
    header ("Location: $KT_redirectLoginSuccess");
    exit;
  }
  $KT_rsUser->Close();
  session_register("KT_login_failed");
  $KT_login_failed = true;
  header ("Location: $KT_redirectLoginFailed");
  exit;
}
?>

What i want to do is after i had set the cookie, then i got to main.php
which is one of the page within the site and i type :
<?
echo $HTTP_COOKIE_VARS["username"];
?>
It got nothing to print out!!!

Pls help!!
Jack
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to