Still not working... here's the entire login function... hopefully you can see what i needs done...
function check_login($loginUsername, $loginPassword){
$salt = substr($loginUsername, 0, 2);
$crypted_password = crypt($loginPassword, $salt);
$query = "SELECT * FROM users WHERE username='$loginUsername'
AND password='$crypted_password' AND activated='1'";
// Open a connection to the DBMS - users_db.inc
include '/home/mypage/www/test/includes/users_db.php';
$connection = @ mysql_pconnect($hostName, $username, $password) or die(mysql_error());
$db = mysql_select_db($databaseName, $connection) or die(mysql_error());
// Execute the query
$result = mysql_query($query) or die(mysql_error());
// Make sure there is only one result!
if (mysql_num_rows($result) == 1){
// Initiate Users' Session ID
$_SESSION["ID"] = $loginUsername;
// Clear Any Errors, may want to clear other session too..
$_SESSION['errors'] = FALSE; // Shouldn't be any errors if were at this point!
// For each row in the db, place it in a session so that we can use it..
$row = mysql_fetch_array($result);
// Pull the session vars together
$_SESSION = array_merge($_SESSION, $row);
echo "Array: " . $_SESSION; // this does not display anthing not even Array: ??
if (!$_SESSION['referer']){
header("Location: [url]http://www.mypage.com/test/index.php[/url]");
exit;
}else{
header("Location: {$_SESSION["referer"]}"); // Send them to the page they wanted!
$_SESSION['referer'] = FALSE; // reset referer!
exit;
}
}else{ // No Result found?
if ($_SESSION['ID'])
$_SESSION['ID'] = FALSE; // Just in case!
// Report Error and Display Login Form!
echo "Unfortunatly, The username or password you
entered do not match any
result in our records. Please Try Agian";
include '/home/mypage/www/test/Members/login_form.html';
exit;
}
} // End check_login()
Just want a simple way to define all the variables as session varibles.. somthing quick and easy...
thanks for all your help!