开发者

How to load user-specific content from client side

I am currently creating user login. If the user logs in with a valid username/password combination, I want it to direct to a webpage that has a lot of user specific content. This content needs to be downloaded via a php file that takes in the username/password from the login to gain access to and echo out the json encoded user-specific content. However, I'm very new to html, so I'm not really sure how to do this, since the login form and the user-specific content page are two different webpages... how do I pass the user-specific content from the log-in page to the new page once the开发者_StackOverflow中文版y log in successfully?

Thanks! Some relevant code is below, it may or may not help clarify my question:

var x = $.post("../research/CruTracker/post_register.php",
{
    username:username,
    password:password,
    id:'web'
},
function (data, textStatus, jqXHR) {
    if(data.success)
    {
        window.location = "home.html"
    }
},
    "json"
);


typically, once logged in you would save a logged in flag and user id in a session on your server. once they are redirected to the home page (which should be a php page), php uses the session data to verify that the user is logged in, and pulls whatever other user specific data from the database it needs to build the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜