Header () does not seem to jump for help

Source: Internet
Author: User
The header () does not seem to jump to seek help. it only receives data comparison and points to two php pages respectively. the php pages are all in one path. The form does not respond after it is submitted...
$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['passwd'];
'If ($ password = "123 "){
Header ("Location: friendlist. php ");
} Else {
Header ("Location: login. php ");
}
?>

UserName:



PassWord:




Reply to discussion (solution)

You need to add an http: // localhost/../*. php in front of the *. php file in the header.

For example, $ host = $ _ SERVER ['http _ host'];
$ Uri = rtrim (dirname ($ _ SERVER ['php _ SELF ']),'/\ ');

For example, $ host = $ _ SERVER ['http _ host'];
$ Uri = rtrim (dirname ($ _ SERVER ['php _ SELF ']),'/\ ');
Can you give me more details? HTTP_HOST refers to http: // localhost/*. php?
Does PHP_SELF mean the php page that receives data?

$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['passwd'];
$ Host = $ _ SERVER ['http _ host'];
$ Uri = rtrim (dirname ($ _ SERVER ['php _ SELF ']),'/\ ');
'If ($ password = "123 "){
Header ("Location: http: // $ host $ uri/friendlist. php ");
} Else {
Header ("Location: http: // $ host $ uri/login. php ");
}

Directly upload the code [hide] teste [/hide]

Is your current page logincontroller. php,
Because: action = "logincontroller. php"

$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['passwd'];
$ Host = $ _ SERVER ['http _ host'];
$ Uri = rtrim (dirname ($ _ SERVER ['php _ SELF ']),'/\ ');
'If ($ password = "123 "){
Header ("Location: http: // $ host $ uri/friendlist. php ");
} Else {
Header ("Location: http: // $ host $ uri/login. php ");
}
Solved! Thank you. what is the meaning of the two codes caused by this problem?

You can check the php Manual.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.