Hello All,
I am trying to create a script that will accept input from a form, and then post it to a webmail script to log the user in.
I need to do some validation checking on the headers that are returned, and i am having a few problems with this...
Here is how i would like my code to work:
if ($err_msgs)
{
echo '<div align="center"><strong>'.$err_msgs.'</strong></div>';
}
else
{
$var_sock = fsockopen($frm_domain, 80, $errno, $errstr, 5);
fputs($var_sock, "POST /mailbox.php HTTP/1.0\n");
fputs($var_sock, "Host: $frm_domain\n");
fputs($var_sock, "User-Agent: maillogin\n");
fputs($var_sock, "Content-Type: application/x-www-form-urlencoded\n");
fputs($var_sock, "Content-Length: " . strlen($var_login) . "\n");
fputs($var_sock, "\n");
fputs($var_sock, $var_login);
}
// need code to grab header returned by server...
// if header contains both of the following values: 'Set-Cookie: session=' and 'Set-Cookie: mail_userid=' then the login was successful, and we should do a header(Location: [url]http://www.domain.com/login.php?session=blah123blah123[/url]);
// blah123blah123 being whatever the session id returned in the header was.
// if the header does not contain 'Set-Cookie: mail_userid=' then just display an error.
Please help