Session usage problems

Source: Internet
Author: User
Tags php session
Session usage problems session I have read the manual above is to first enable session (); then in a session variable $ _ SEESION ['user'] = 'user '; but I don't know how to use two pages. one page is login. php, logon page, one is edit. php session usage problems
Session I read the manual. the above is to enable session () first ();
Then in a session variable
$ _ SEESION ['user'] = 'user ';
But I don't know how to use it.


Two pages: login. php, logon page,
One is edit. php. how can I use the same SESSION on the two pages? the content in the SESSION can be viewed only after logon.

Login. php code

 $ Name = 'Vicky ';
$ User = 'Vicky ';
$ Passwd = '001 ';
$ Pwd = '001 ';

Seesion_start ()

If ($ name = $ user & $ passwd = $ pwd ){
// The value above this position is true. in principle, the session should be executed. what should I do?
$ _ SESSION ['$ name'] =' $ name ';

} Else {
Echo 'Log On Again ';

}


How can I determine the session ID on another edit. php page?
Enable seeion_start ();

Share:
------ Solution --------------------
$ _ SESSION ['name'] = $ name; // do you want to do this?

How can I determine the session ID on another edit. php page?
Enable seeion_start ();
Yes, you must also enable seeion_start ();
Echo $ _ SESSION ['name']; // view the result

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.