perdona, pero no sabria decirte donde hago un asignacion de la sesion, intento aprender todavia las sesiones y phpoo
los codigos que he rastreado
function isUserLoggedIn()
Código PHP:
Ver originalfunction isUserLoggedIn() {
global $loggedInUser, $db, $db_table_prefix;
if ($loggedInUser == NULL) { return false; }
else {
$sql = "SELECT User_ID,
Password
FROM " . $db_table_prefix . "Users
WHERE
User_ID = '" . $db->sql_escape($loggedInUser->user_id) . "'
AND
Password = '" . $db->sql_escape($loggedInUser->hash_pw) . "'
AND
Active = 1
LIMIT 1";
//Query the database to ensure they haven't been removed or possibly banned?
if (returns_result($sql) > 0) { return true; }
else {
//No result returned kill the user session, user banned or deleted
$loggedInUser->userLogOut();
return false;
}
}
}
function destorySession()
Código PHP:
Ver originalfunction destorySession($name)
{
if(isset($_SESSION[$name])) {
$_SESSION[$name] = NULL;
}
}
function userLogOut()
Código PHP:
Ver originalfunction userLogOut()
{
destorySession("userCakeUser");
}
y el login php
Código PHP:
Ver original{
$username = trim($_POST["username"]); $password = trim($_POST["password"]);
//Perform some validation
//Feel free to edit / change as required
if($username == "")
{
$errors[] = lang("ACCOUNT_SPECIFY_USERNAME");
}
if($password == "")
{
$errors[] = lang("ACCOUNT_SPECIFY_PASSWORD");
}
//End data validation
{
//A security note here, never tell the user which credential was incorrect
if(!usernameExists($username))
{
$errors[] = lang("ACCOUNT_USER_OR_PASS_INVALID");
}
else
{
$userdetails = fetchUserDetails($username);
//See if the user's account is activation
if($userdetails["Active"]==0)
{
$errors[] = lang("ACCOUNT_INACTIVE");
}
else
{
//Hash the password and use the salt from the database to compare the password.
$entered_pass = generateHash($password,$userdetails["Password"]);
if($entered_pass != $userdetails["Password"])
{
//Again, we know the password is at fault here, but lets not give away the combination incase of someone bruteforcing
$errors[] = lang("ACCOUNT_USER_OR_PASS_INVALID");
}
else
{
//Passwords match! we're good to go'
//Construct a new logged in user object
//Transfer some db data to the session object
$loggedInUser = new loggedInUser();
$loggedInUser->email = $userdetails["Email"];
$loggedInUser->user_id = $userdetails["User_ID"];
$loggedInUser->hash_pw = $userdetails["Password"];
$loggedInUser->display_username = $userdetails["Username"];
$loggedInUser->clean_username = $userdetails["Username_Clean"];
//Update last sign in
$loggedInUser->updateLastSignIn();
$_SESSION["userCakeUser"] = $loggedInUser;
//Redirect to user account page
header("Location: account.php"); }
}
}
}
}
?>
alomejor ya se declara en el login php al introducir los datos y por eso hace conflicto.