Is $ _ POST and $ _ GET redundant? PHP seems to be able to automatically obtain the data of the post or get request, and does not need to use the $ _ POST or $ _ GET array. For example:
$ UserName = $ _ POST ["userName"];
$ PS = $ _ POST ["PS"];
Echo "the user name you entered is:". $ userName;
Echo"
The password you entered is: ". $ PS;
?>
Even if you can still GET the form data after removing the $ _ POST lines in the code, do I think $ _ POST and $ _ GET are redundant, in addition, I think this is the biggest difference between PHP and ASP. ASP cannot be obtained without a request set.
Reply to discussion (solution)
$ _ POST is a global variable.
That's because you enabled register_globals. But register_globals is safe only when it is turned off. it is not good for you to write code like this.
I feel like I have returned to the php4 age.
Well, this is a simple aspect of php, but this is a bad aspect of writing: it will be complicated if there are more variables.
Oh, I have never touched on PHP before. I saw such an example in a book. I didn't talk about security at all, so I thought it was okay.
Php seems to be quite active in this regard, and there are not many hard requirements, but there are more things to do, and the code written is more rigorous.
Which website has your register_globals enabled?
I have prepared a text.
Xxx. php? UserName = abc & PS = 1
Xxx. php? UserName = abc & PS = 2
Xxx. php? UserName = abc & PS = 3
......
Xxx. php? UserName = abc & PS = 999999
This is much more convenient than getting 999999 posts, although post is not difficult.
It would be more fun if you post and upload something.