Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8368761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:27:49+00:00 2026-06-09T13:27:49+00:00

I have two files in two domain http://example1.com/remote_login.php and http://example2.com/login.php While user accessing http://example1.com/remote_login.php

  • 0

I have two files in two domain

     http://example1.com/remote_login.php

and

     http://example2.com/login.php

While user accessing http://example1.com/remote_login.php I want to do some validations in remote_login.php , after that I want to post the username and password to http://example2.com/login.php If the result is success, user should be redirect to http://example2.com/index.php ( Also I am checking session in http://example2.com/index.php )

Any Idea

Sorry for my bad english

I Have tried it using curl, but its not working it will login, but not setting session. so user can’t redirect to index.php

$cookie="cookie.txt"; 
$data = array();
$data['global_id'] = "raj";
$data['global_password'] = "raj";

foreach ($data as $key => $value){
    $post_items[] = $key . '=' . $value;
}

//create the final string to be posted using implode()
$post_string = implode ('&', $post_items);


$curl_connection = curl_init('http://example2.com/login.php');
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);

curl_setopt($curl_connection, CURLOPT_USERAGENT,"Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1");

curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl_connection, CURLOPT_FAILONERROR, TRUE);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_connection, CURLOPT_REFERER, 'http://example2.com/login.php');
curl_setopt($curl_connection, CURLOPT_POST, true);
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl_connection, CURLOPT_HEADER, FALSE);
curl_setopt($curl_connection, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($curl_connection, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($curl_connection, CURLOPT_SSLVERSION, 3); // OpenSSL issue
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, 0);  // Wildcard certificate
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($curl_connection);


if($result){
    header("Location: http://example2.com/index.php");

}
else{
    echo "Login failed";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:27:51+00:00Added an answer on June 9, 2026 at 1:27 pm

    This is quite a big task. The reason why the user is not being logged in is because the session will not be set on their machine, but instead, on the server (if it accepts cookies). So what you’re doing now is pretty useless.

    With that said, you could setup some kind of system where every remote login will trigger some sort of “validation ID” to be produced which can then be returned to that specific user, and then the user gets redirected to a link (validateSession.php?), passing the specific ID to confirm identity, and all the sessions get set there…

    That’s a huge task though.

    Also note: This is not 100% secure unless you’re using SSL to prevent middle man attacks. A middle man attack is when some evil monster listens to what is being sent from client to server and vice versa. So if someone gets hold of that ID, you’re on trouble. Or even worse, if they get hold of the users username and pass….oh boy…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two files client.php and server.php. The client file send a HTTP request
I have two files 1 - index.php 2 - main.php index.php call to main.php
i have two files:(localhost/template/) index.php template.php each time when i create an article(an article
I have two files and the content is as follows: alt text http://img144.imageshack.us/img144/4423/screencapture2b.png alt
I have the following redirects in my htaccess file Redirect 301 /communityed/index.htm http://www.domain.com/community_education Redirect
I'm confused about MVC routes. Let's say I have this domain: poopoopants.com. I want
I have two files: public interface PrintService { void print(PrintDetails details); class PrintDetails {
I have two files: domainList and config.cnf. The domainList file simply has a list
I have two files called file_utils.h and file_utils.cpp which contain some methods and variables
I have two files which both contain a list of words. Is there an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.