How PHP prevents a page. was opened at the same time.

Source: Internet
Author: User
PHP How to prevent a page: was opened at the same time.
PHP How to prevent a page: Be opened at the same time .... What is the way to achieve it ... JS is ok. Thank you.

------Solution--------------------
Add the following code to the beginning of the program
PHP Code
$FN = __file__. ' Lock ', if (file_exists ($FN)) exit (' Access Denied '); File_put_contents ($fp, '); Ob_start (' unlock '); function unlock ($buffer) {g  Lobal $FN;  Unlink ($FN); return $buffer;}
------Solution--------------------
Well, you can't rely on session control, it's fraudulent.
Can only rely on the service side guarantee only open, flock file lock on it.

PHP Code
    
------Solution--------------------
The landlord may be doing a management system, because some management system will have special requirements or worry about the simultaneous insertion of the problem.
With the database bar, the core is
The IP (or user ID) and path of the currently open page are associated, just like a federated primary key.
Openuser Openpage
1 index.php
2 modules/user/user_list.php
3 modules/user/user_list.php//This is wrong, because User 1 already has the "modules/user/user_list.php" page open.
------Solution--------------------
Well, I was just worried that he wanted a man.have been"Open" case, do not let others "open" .....



Explore

The landlord may be doing a management system, because some management system will have special requirements or worry about the simultaneous insertion of the problem.
With the database bar, the core is
The IP (or user ID) and path of the currently open page are associated, just like a federated primary key.
Openuser Openpage
1 index.php
2 modules/user/user_list.php
3 modules/user/user_list.ph ...
  • 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.