Phpsession-php Tutorial

Source: Internet
Author: User
Phpsession problems this post was last edited by u010001532 in 2013-06-0818: 00: 51. I want to use session to log on to a user to access a specific page. users who are not logged on cannot access it. However, you can directly access the page by entering the page address in your browser. For guidance. Index. phpsession_start (); if (Login () & nbsp; & nbs php session

This post was last edited by u010001532 at 18:00:51

I want to use session to log on to a user to access a specific page. users who are not logged on cannot access the page.

However, you can directly access the page by entering the page address in your browser. For guidance.

// Index. php

Session_start ();
If (Login () = true)
{
$ _ SESSION ['login'] = 'OK ';
// Jump to page. php
}
Else
{
Echo "Login error ";
}


// Page. php

Session_start ();
Echo $ _ SESSION ['login'];

If (empty ($ _ SESSION ['login']) | $ _ SESSION ['login']! = 'OK') // skip to the index if you have not logged in
{
?> Script setTimeout ('window. location = "index. php" ', 1000); script }
.....
.....

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.