Php logon access problems

Source: Internet
Author: User
Php login access problems can be simply entered into the web page login, but I think a user can only manage data in one village. after logging in, the address bar? Id = I can log on to the console as needed & #183; & #183; & #183; for example, if a user logs in with an account of 1, only 1 of the data can be managed.
Make a simple webpage entry


Yes, but I think a user can only manage data in one village. after logging in, what is the address bar? Id = I can log on to the console as I like ···
For example, if a user logs in with an account of 1, he can only manage data of 1, but change 1 to 2 in the address bar. how can he manage data of 2?

Logon page $ Conn = mysql_connect ("localhost", "xypi20", "a16812343 ");
Mysql_select_db ("js ");
Mysql_query ("set names 'gb2312 '");

If (isset ($ _ POST ["user"]) {
$ User = $ _ POST ["user"];
$ Password = $ _ POST ["password"];
$ SQL = "select * from login where user = '{$ user}' and password = '{$ password }'";
$ Query = mysql_query ($ SQL );
$ Array = mysql_fetch_array ($ query );



If ($ user ==$ array {'user'} and $ password ==$ array {'password '}){

$ Kind = $ array {'kind '};

Session_start ();


$ _ SESSION ['keyword'] = "$ kind ";

Echo "script alert ('logon successful! '); Location. href = 'Test. php? Id = $ kind '; script ";}

Else
Echo "script" alert ('log on again! '); Location. href = 'login. php'; script ";
}



?>

Management Interface
$ Conn = mysql_connect ("localhost", "xypi20", "a16812343 ");
Mysql_select_db ("js ");
Mysql_query ("set names 'gb2312 '");
$ Kind = $ _ GET ['id'];
/* Session_start ();
If (! Isset ($ _ SESSION ['keyword'])


Echo "script" alert ('log on! '); Location. href = 'login. php'; script "; */
Echo $ kind;
Session_start ();

If (isset ($ _ SESSION ['keyword'])! = $ Kind)

Echo "script" alert ('log on! '); Location. href = 'login. php'; script ";


?>

If (isset ($ _ POST ["name"], $ _ POST ["time"]) {

$ Name = $ _ POST ["name"];
$ Time = $ _ POST ["time"];
Echo $ name;
Echo $ time;
Echo $ kind;
$ SQL = "SELECT * FROM data where kind = '$ kind '";
If ($ name) // name is not empty
{
$ SQL. = "and name = '$ name '";
If ($ time)
$ SQL. = "and input time = '$ time '";

}
Elseif ($ time)
{
$ SQL. = "and input time = '$ time '";

}


The problem is that in this query, I am directly where kind = '$ kind', so no matter what account is used to log in and modify the kind in the address bar, you can query other data ···

------ Solution --------------------
$ Fuck
Related Article

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.