Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Mesmo login em 2 sites


Você está procurando um Script de logon único usando PHP. Esse é o termo que você precisa procurar. Um modelo simples seria:

Site:http://auth.local/ :
<?php
  // Get the request.
  // Validate the session.
  // Pass a Secure Hash and log the user in to the main domain.
?>

Site:http://site1.local/ :
<?php
  // Check if there is a session.
  // If already logged in, no problem.
  // If not, send him back to auth.
  header("Location: http://auth.local/?redirect_to=http://site1.local/");

Site:http://site2.local/ :
<?php
  // Check if a session is there.
  // If already logged in, no problem.
  // If not, send him back to auth.
  header("Location: http://auth.local/?redirect_to=http://site2.local/");

Veja as respostas para a pergunta Como fazer logon único com PHP? para mais informações.