T
T
twopizza2015-12-22 04:37:02
PHP
twopizza, 2015-12-22 04:37:02

How to determine if another site has been visited?

There are 2 sites with full access to them. When visiting site 2, it is necessary to determine whether the user has previously visited site 1. Now the referrer is looking, but it works with a direct transition, are there any options for this to work even with an indirect transition?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wol_fi, 2015-12-22
@wol_fi

Alternatively, pull a script/image (1x1 gif, for example)/blank page from site 1 on site 2, which will set a cookie for the domain of site 2. And do the same on site 2 - pull a script/image/blank page on site 1 , and set a cookie for the site domain 1. Pull all this from the client, of course. And on the server to already determine the visit by the presence of this cookie.

A
Andrzej Wielski, 2015-12-22
@wielski

On the first site, we save the user's IP somewhere (to the database or to a file, it doesn't matter).
We create some kind of php script that checks if there is an IP in the database (or in the file) according to the accepted parameter (for example, site1.ru/scriptname.php?ip=1.2.3.4), and issue 1 or 0, respectively
From the second site we make a request to this script (it is possible through the same file_get_contents), substituting the user's IP.
We check if the answer is 1 - everything is fine, if 0 - the user did not visit the first site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question