Login SOAP Web Service

0

Follow my login code to webservice soap

   if (isset($_POST["action"]) && $_POST["action"] == "login") {
$soapClient = new SoapClient(WEST_SOAP_WSDL,
    array("trace" => WEST_SOAP_TRACE, "login" => WEST_SOAP_LOGIN, "password" => WEST_SOAP_PASS));

try {
    $clienteId = $soapClient->loginAuth($_POST["username"]);
} catch (Exception $e) {
     print_r($e);
}

if ($clienteId) {
    session_regenerate_id(TRUE);

    $_SESSION["auth"]["id"] = $clienteId;
    $_SESSION["auth"]["username"] = $_POST["username"]; 

    try {
        $_SESSION['cliente'] =   serialize($soapClient->getClientDataById($clienteId));
    } catch (Exception $e) {
     print_r($e);
    }

How could I Restrict Access to my Subscriber Panel in php in the statuses below? :

        inativo
        cancelado
        serasa
    
asked by anonymous 19.07.2016 / 17:02

1 answer

0

As I understood your question, you would need a user-generated database to be passed by session , thus checking to see if this user first found

 $myusername = mysqli_real_escape_string($db,$_POST['username']);
 $mypassword = mysqli_real_escape_string($db,$_POST['password']); 

  $sql = "SELECT id FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";

 $status "SELECT status FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";

  $result = mysqli_query($db,$sql);
  $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  $active = $row['active'];

  $count = mysqli_num_rows($result);
  if($count == 1){
     if($status != 'inativo' && $status != 'cancelado' && $status != 'serasa')
     {
        header("location: welcome.php");
     }
     else
      {
        echo"erro";
      }
  }
  else {
    echo"erro";
  }

I added the select status in a variable to serve as a check, so it evaluates whether or not it is serving the same.

    
19.07.2016 / 22:22