簡體   English   中英

無法登錄Usercake

[英]Can't Log in on Usercake

我正在嘗試將用戶蛋糕整合到我的網站上。 我安裝了它並注冊了一個帳戶。 當我嘗試使用該帳戶登錄時,瀏覽器將加載,然后沒有任何反應,並且我無法進入該帳戶。

<?php
/*
    UserCake
    http://usercake.com

    Developed by: Adam Davis
*/
require_once("models/config.php");

//Prevent the user visiting the logged in page if he/she is already logged in
if(isUserLoggedIn()) { header("Location: account.php"); die(); }
?>
<?php
/* 
    Below is a very simple example of how to process a login request.
    Some simple validation (ideally more is needed).
*/

//Forms posted
if(!empty($_POST))
{
    $errors = array();
    $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
    if(count($errors) == 0)
    {
        //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");
                    die();
                }
            }
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<link href="cakestyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="content">

    <div id="left-nav">
    <?php include("layout_inc/left-nav.php"); ?>
        <div class="clear"></div>
    </div>

    <div id="main">

    <h1>Login</h1>

    <?php
    if(!empty($_POST))
    {
    ?>
    <?php
    if(count($errors) > 0)
    {
    ?>
    <div id="errors">
    <?php errorBlock($errors); ?>
    </div>     
    <?php
    } }
    ?> 

        <div id="regbox">
            <form name="newUser" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
            <p>
                <label>Username:</label>
                <input type="text" name="username" />
            </p>

            <p>
                 <label>Password:</label>
                 <input type="password" name="password" />
            </p>

            <p>
                <label>&nbsp;</label>
                <input type="submit" value="Login" class="submit" />
            </p>

            </form>

        </div>
    </div>

        <div class="clear"></div>
    </div>
</div>
</body>
</html>

沒關系。 問題出在我的虛擬主機及其php會話配置上。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM