如何从客户端加载用户特定的内容
我目前正在创建用户登录。如果用户使用有效的用户名/密码组合登录,我希望它定向到具有大量用户特定内容的网页。此内容需要通过 php 文件下载,该文件从登录名中获取用户名/密码,以访问并回显 json 编码的用户特定内容。但是,我对 html 很陌生,所以我不太确定如何执行此操作,因为登录表单和用户特定内容页面是两个不同的网页...我如何传递用户特定内容登录成功后将登录页面跳转到新页面?
谢谢!下面是一些相关代码,它可能有助于也可能无助于澄清我的问题:
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"
);
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 they 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"
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,登录后您将在服务器上的会话中保存登录标志和用户 ID。一旦它们被重定向到主页(应该是 php 页面),php 就会使用会话数据来验证用户是否已登录,并从构建页面所需的数据库中提取任何其他用户特定数据。
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.