Advertisement

05.08.2008 at 09:50AM PDT, ID: 23386784
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

2.5

Forward POST vars (username, password) to other web sites.

Asked by CtrlAltDl in PHP Scripting Language

Tags:

I'm trying to do something similar to this:
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_20781687.html

I want one login page, on our main website (which is asp.net) that posts username and password form fields to a php page that checks a remote MySQL database (customer web portal #1) for that login and username.   <-- this is working fine.

If that login and password is part of that web portal #1 then I need to POST that username and password to the checkLogin.php page, so they will be logged in.

With the following php page I keep getting "Couldn't create the cookie.".Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
//Check for username in the database.
$qstr = "SELECT  UserID FROM tblUsers ";
$qstr .= "WHERE UserName = '" . $_POST['username'] . "' ";
$qstr .= " AND Password = '" . md5($_POST['password']) . "' ";
 
$results = mysql_query($qstr, $db); 
 
if (!$results)
{
	echo("An error occured issuing SELECT command to the SQL server \n");
	print $qstr."<br />";
}
else
{
	if (mysql_num_rows($results) == 0) //no user and pass
	{
		//You not a user!
	}
	$url = 'http://mydomain.com/customerLogin.php';
	$args = 'Username=' . $_POST['username'] . '&Password=' . $_POST['password'] . '';
	
	$url = parse_url($url);
	if (empty($url['port'])) $url['port'] = 80;
	$socket = fsockopen($url['host'], $url['port'], $errno, $errstr)
		or print("error # $errno while opening socket: $errstr <br />\n");
	fputs($socket, "POST " . $url['path'] . " HTTP/1.0\n");
	fputs($socket, "Host: " . $url['host'] . "\n");
	fputs($socket, "User-Agent: PSWLogin\n");
	fputs($socket, "Content-Type: application/x-www-form-urlencoded\n");
	fputs($socket, "Content-Length: " . strlen($args) . "\n");
	fputs($socket, "\n");
	fputs($socket, $args);
	$out = '';
	while (!feof($socket)) {
		$line = fgets($socket, 1024);
		if (preg_match('/^set-cookie:\s*PHPSESSID=([a-z0-9]+)/i', $line, $matches)) {
			$cookie = $matches[1];
			break;
		}
	}
	if (empty($cookie)) {
		echo "Couldn't create the cookie.";
	} else {
		header("Location: http://" . $url['host'] . "/?PHPSESSID=$cookie");
	}
}
[+][-]05.08.2008 at 11:12AM PDT, ID: 21527043

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 11:14AM PDT, ID: 21527070

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 02:01PM PDT, ID: 21528443

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 02:03PM PDT, ID: 21528454

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 02:31PM PDT, ID: 21528650

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 12:10PM PDT, ID: 21535658

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 12:31PM PDT, ID: 21535792

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 12:41PM PDT, ID: 21535870

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.09.2008 at 01:14PM PDT, ID: 21536100

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: PHP
Sign Up Now!
Solution Provided By: harrrrpo
Participating Experts: 2
Solution Grade: B
 
 
[+][-]05.12.2008 at 03:07PM PDT, ID: 21550888

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.04.2008 at 10:09AM PDT, ID: 21712035

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628