A server that allows only one request per session

Scenario:

All xyz.com pages use sessions to check if I have logged in and did not display customized content. I registered at xyz.com using Firefox on my iMac. Now when I try to visit, xyz.com/page1.php and xyz.com/page2.php at the same time until page1 loads page2.

Code Samples

xyz.com/contains (links):

/* session check code here */
Page1
Page2

xyz.com/page1.php contains:

/* session check code here */
echo "Hello";
flush();
sleep(5);
echo "done";

xyz.com/page2.php contains:

/* session check code here */
echo "Second Page";
/* {insert code} to log time() to log.txt */

Testing

That's what I'm doing. I can enter the shell and run this command:

user@xyz.com [~/public_html]# tail -f log.txt

(Firefox), ( xyz.com), page1 page2 . , 1 5 . , 1, 2 . . ? 2 , . :

, ( ) 1. page1.php 2. page2.php 3. page2.php 4. page1.php 5. page1.php 6. page2.php

()

1237961919 < - # 2
1237961920 < - # 3
1237961931 < - # 6

()

1237961915 < - # 2
1237961915 < - # 3
1237961915 < - # 6

^ ,

, , xyz.com( ). , (Safari), . , ?

  • ?

    , - , (VPS), , apache/php.

  • ?

    ? ?

  • VPS.

    , . . , - , .

+3
5

session_write_close() page1.php .

/* session check code here */
session_write_close();
echo "Hello";
flush();

( ), page2.php .

http://php.net/manual/en/function.session-write-close.php

+4

. , , , .

, , .

+3

. , CGI FastCGI? , php- -, .

, .

0

, php, asp.net / . , . , "", . , , .

0

Source: https://habr.com/ru/post/1705315/


All Articles