if ($response3->CheckUserNameAndEmailResult == -2) {
            $msg = "Email Already Registred aginst this publication";
        } else {
            if ($response3->CheckUserNameAndEmailResult == -3) {
                $msg = "You have recently attempted with similar username. please try with different username or try after 24 hours from your last attempt.";
            } else {
                drupal_goto('order-review');
            }
        }
    }
}
if (isset($_POST['submit'])) {
    $param1 = array("SubscriberID" => $_POST['plandetail']);
    $_SESSION['plandetail'] = $_POST['plandetail'];
    $client = new soapclient('http://etypeservices.com/Service_GetPublicationID.asmx?wsdl');
    $response1 = $client->GetPublicationID($param1);
    $param = array("PublicationId" => $response1->GetPublicationIDResult);
    $client = new soapclient('http://etypeservices.com/Service_GetSubsciptionPlan.asmx?wsdl');
    $response = $client->GetSubsciptionPlan($param);
    //echo "<pre>";
    //   print_r($response);
    //   echo "</pre>";
}
?>

<form name="form2" id="form2" method="POST" action="" enctype="multipart/form-data">
     
        <h3 style="background:gray;font-size:16px;line-height: 2.0em;"><center>Cart contents</center></h4>
            <p style="color:red"><?php 
echo $msg;
?>
<?php 
if (isset($_POST['send'])) {
    $uname = $_POST['mail'];
    $param12 = array('UserName' => "{$uname}");
    $client12 = new soapclient('http://etypeservices.com/service_GetPublicationIDByUserName.asmx?WSDL');
    $response12 = $client12->GetPublicationID($param12);
    //echo "<pre>";
    //print_r($response12);
    //echo "</pre>";
    if ($response12->GetPublicationIDResult == -9) {
        $msg = "Invalid UserName ";
    } else {
        if ($response12->GetPublicationIDResult == 3053) {
            $param = array('UserName' => $uname);
            $client = new soapclient('http://etypeservices.com/service_ForgetPassword.asmx?WSDL');
            try {
                $response = $client->ForgetPassword($param);
                if ($response->ForgetPasswordResult == 1) {
                    $msg = "Credentials have been sent to your registered email";
                } else {
                    $msg = "User is Not Registered For This Publication";
                }
            } catch (Exception $e) {
                echo '' . $e->getMessage();
            }
        } else {
            $msg = "User Not Exists";
        }
    }
}
?>
 function getEntitlements($params)
 {
     //$query = $this->getEntitlementsQuery2();
     //$entitlements = $this->queryMSSQL('Etype', $query, $params);
     //echo "entitlements: ", count($entitlements), " results\n"; print_r($entitlements); echo "\n";
     $username = $params['0']['0'];
     $Password = $params['0']['1'];
     // this result means the username/password did not return a record
     $param12 = array('UserName' => "{$username}");
     $client12 = new soapclient('http://etypeservices.com/service_GetPublicationIDByUserName.asmx?WSDL');
     $response12 = $client12->GetPublicationID($param12);
     if ($response12->GetPublicationIDResult == -9) {
         $return = $this->buildOutput("KO", "User or password invalid. Please try again");
     } else {
         if ($response12->GetPublicationIDResult == 1213) {
             $param = array('UserName' => "{$username}", 'Password' => "{$Password}");
             $client = new soapclient('http://etypeservices.com/Service_SubscriberLogin.asmx?WSDL');
             $response = $client->ValidateSubscriber($param);
             if ($response->ValidateSubscriberResult == -5) {
                 $return = $this->buildOutput("KO", "User or password invalid. Please try again");
             } elseif ($response->ValidateSubscriberResult == -1) {
                 $expired = array();
                 // expired subscriptions
                 $canView = array();
                 // active subscriptions
                 //$pubview =array();
                 $outputStarter = "<key>output</key><array>";
                 $outputBody = '';
                 $outputEnder = "</array>";
                 $pubview = $response12->GetPublicationIDResult;
                 $pre = "smr";
                 $canView[strtolower($pre)] = true;
                 $return = $this->buildOutput("KO", "Your subscription to San Marcos Record expired . Please contact the Helpdesk to renew your subscription", $canView, $pubview, $pre);
             } else {
                 $expired = array();
                 // expired subscriptions
                 $canView = array();
                 // active subscriptions
                 //$pubview =array();
                 $outputStarter = "<key>output</key><array>";
                 $outputBody = '';
                 $outputEnder = "</array>";
                 $pubview = $response12->GetPublicationIDResult;
                 $query = "select name, uid from users where name='" . $username . "'";
                 $qu = db_query($query);
                 $useruid = "";
                 foreach ($qu as $qu) {
                     $useruid = $qu->uid;
                 }
                 global $user;
                 $user = user_load($useruid);
                 drupal_session_regenerate();
                 $pre = "smr";
                 $canView[strtolower($pre)] = true;
                 $return = $this->buildOutput("OK", "Success", $canView, $pubview, $pre);
             }
         } else {
             $return = $this->buildOutput("KO", "User or password invalid. Please try again");
         }
     }
     return $return;
 }