I have a login form in PHP and MySQL for example in a domain named "login.example.com" and I want it to login to another website for example "home.example.com" at the same time that I login into the first domain, how can I do it without using cookies?
The values that I want to transfer between the domains is the email and the password.
$email = e($_POST['email']); //The email of the user
$password = e($_POST['password']); //The password of the user
You have two options,
After login approved, load a pixel image with the URL of your second domain (subdomain) EX :
echo "< img href=' https://sub.example.com ' />"
In both option, you have to run the script on your second domain (subdomain) to set the session
Update
Example to set a session :
$_SESSION['login'] = $id;
Update 2
It's not a good practice to transfer email and password between domains (subdomains), it's not secure, but you can setting cookie or session to identify the email and password with a unique ID which could be transferred between domains (subdomains)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.