Google Chrome version - 25.0.1364.172 m

The principle of operation is as follows:

  1. User visits the page (script number 1)
  2. He is running
  3. After this, the header is sent (redirect to script №2)
  4. Script number 2 takes the baton
  5. Performed
  6. Returns the baton to the script number 1 and the script number 1 shows the result

The problem is the protection of the browser. If I make headlines, I get error 310. And if I try to finish the work of script No. 2 by outputting javascript code or a refresh meta tag to the browser, the browser simply loops to refresh the page (script No. 2), even if it is specified that you need to redirect to another subdomain , not to mention another directory of the same domain. Redirects only if the destination domain is completely different.

Does anyone have any idea what could be the reason for this strange behavior of the browser? And what to do? It is necessary that the principle of the relay worked in all browsers.

UPD

Why is the code here if the question is not about the code? Anyway. Code like this:

script1.php

<? header ("Location: script2.php"); exit(); ?> 

script2.php

 <? header ("Location: script1.php"); exit(); ?> 

Only the whole point is that in the first script the condition first goes, and if it is not met, then the second script goes to the second script that enters the necessary data into the database and when the second script completes its work, the request to the first script should be repeated, in which the condition will already be met (due to the work done by the second script) and, accordingly, the first script will no longer refer to the second script and will perform completely different actions not related to redirects.

UPD2

script1.php

 <? Если переменная $_SESSION['category'] == '2' то выводим слово "БДСМ", а если нет, то делаем редирект на второй скрипт header ("Location: script2.php"); exit(); ?> 

script2.php

 <? $_SESSION['category'] = '2'; header ("Location: script1.php"); exit(); ?> 

A simple example with a session variable. Well, now everyone understands the logic? :))) I understand that you can do everything in one script and it will work fine, but I’m wondering if it is possible to somehow distribute duties to different scripts so that they work on the principle of transferring an estefetnoy stick, or, as it were, played "CIFU" until a certain moment. :) I don’t already know how the boys explain what I want to achieve from Google ChromA. :)))))

UPD 3

What I gave as an example - I did not test and it works yes, but for some reason, when two real big scripts work, glitches or errors described above occur and only in Google Chrome, although there is nothing special in the scripts and in a general sense they are logically folded in the same way as my session example, only the scripts work with the database and don’t transfer anything to each other, but the first one says to the second one - “I don’t have data, work on you too”. I will not apply the code, because my conscience will not allow me to ask anyone to figure it out. :)))

Sorry for the "ghost hunt." :) Thank you all, especially @eicto and my friend @ReinRaus . :)))

  • So far, I have not invented anything better than passing the baton from the first script to the second cURL and then redirecting to script # 1. That is, during the execution of the script number 1, he seems to call the script number 2 and then starts over, but after the second script is working, it already shows the result, as it should, and does not pass the baton. Horror, I don’t even hope that someone understands what I mean. :))) - Angelina_Jo
  • Oh. Not. Error 310 anyway. The browser doesn't care that the conditions have changed and for it redirection from the page to itself is like evil. :( - Angelina_Jo
  • one
    > Error 310: What kind of "error"? - user6550
  • one
    Yes, it collects the botnet, with XSS. Help her out already. header ('Location: example.com/page1' ); // works? You can also add more anti-headers more. - istem
  • one
    For example, instead of a redirect in the second script, you can do include ("script1.php"); then it will be executed with the values ​​already set. @istem, this is hardly a botnet, rather it is a collection of data about the browser (the physical dimensions of the screen, whether cookies and javascript are included) - in general those data about the client that can be collected using javascript. - ReinRaus

1 answer 1

Use Ajax for this: make the request logic for the necessary scripts on the client and the problem will disappear by itself, since Redirect will not be needed. Use redirects "round-trip" - antipattern, which is clearly filtered by browsers.