如何从我所在的文件重定向到新的php文件? [英] How do I redirect to a new php file from the one I am in?

查看:87
本文介绍了如何从我所在的文件重定向到新的php文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我有一个login.php脚本,它接受用户的登录名和密码,

然后我在数据库中搜索条目并发现他们是否有权访问

0是管理员或访问1,这是普通用户。基于此,我想将
重定向到一个新的php文件。 admin.php或user.php取决于访问级别上的
。= l。简单的解决方案我肯定。


感谢您的帮助。

Basically I have a login.php script that takes the users login and password,
I then search in the database for the entry and discover if they have access
0 which is admin or access 1 which is normal user. Based on this I want to
redirect the user to a new php file. Either admin.php or user.php depending
on the access level.=l. Simple solution I am sure.

Thanks for the help.

推荐答案

C-man写道:
C-man wrote:
基本上我有一个login.php脚本,它接受用户登录和
密码,然后在数据库中搜索条目并发现他们是否可以访问0是管理员或访问1,这是普通用户。基于
这我想将用户重定向到一个新的php文件。 admin.php或
user.php取决于访问级别。= l。简单的解决方案我肯定。
Basically I have a login.php script that takes the users login and
password, I then search in the database for the entry and discover if they
have access 0 which is admin or access 1 which is normal user. Based on
this I want to redirect the user to a new php file. Either admin.php or
user.php depending on the access level.=l. Simple solution I am sure.




if(



if(


access == 0){

header (Location:admin.php);

}

else {

header(" Location:user.php");

}


我很确定我曾经读过一个指定文件名的地方

应该是一个完整的网址包含域名等,但它只是指定文件名。

总是为我工作。


克里斯


-

Chris Hope

电动工具箱有限公司
http://www.electrictoolbox.com/
access == 0) {
header("Location: admin.php");
}
else {
header("Location: user.php");
}

I''m pretty sure I once read somewhere that the filename specified is
supposed to be a full url containing the domain name etc as well but it''s
always worked for me just specifying the filename.

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/


Chris Hope写道:
Chris Hope wrote:
header(" Location:user.php");
header("Location: user.php");




这是相对网址。权威来源RFC2616表示

Location标题字段值由单个绝对URI组成。对于

的实际目的,在我看来,我们可以采用URI。这里的意思是

" URI reference",即绝对URI可以附带一个

片段标识符。

http://www.ietf.org/rfc/rfc2616.txt

-

Jock



That''s a relative URL. The authoritative source, RFC2616, says the
Location header "field value consists of a single absolute URI". For
practical purposes, in my opinion, we can take "URI" here to mean
"URI reference", i.e., the absolute URI could be accompanied by a
fragment identifier.

http://www.ietf.org/rfc/rfc2616.txt

--
Jock


这篇关于如何从我所在的文件重定向到新的php文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆