N
N
nemisqe2017-09-26 23:10:36
PHP
nemisqe, 2017-09-26 23:10:36

How to make PHP code activated when clicked?

In general, I want to make it so that when clicking on an element, the user is redirected to another page if he is not registered on the site. How can this be done with Javascript and PHP? In PHP I'm going to use the header('location: sign_in.php') function.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2017-09-26
@nemisqe

nemisqe , As already written, do it in pure js.

let cookies = document.cookie;
if(cookies==0){
document.location.href = 'http://yandex.ru';
}

In general, learn! https://learn.javascript.ru/cookies

A
Adamos, 2017-09-26
@Adamos

Javascript itself is able to send the user to another page.
For example, not finding session cookies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question