Exemplo n.º 1
0
<?php

/*
	customers/portal-process.php

	access: customers_write

	Allows adjustments of the customer's portal interface.
*/
// includes
require "../include/config.php";
require "../include/amberphplib/main.php";
// custom includes
require "../include/customers/inc_customers.php";
if (user_permissions_get('customers_write')) {
    $obj_customer = new customer_portal();
    /*
    	Load POST data
    */
    $obj_customer->id = @security_form_input_predefined("int", "id_customer", 1, "");
    // check password (if the user has requested to change it)
    if ($_POST["password"] || $_POST["password_confirm"]) {
        $data["password"] = @security_form_input_predefined("any", "password", 4, "");
        $data["password_confirm"] = @security_form_input_predefined("any", "password_confirm", 4, "");
        if ($data["password"] != $data["password_confirm"]) {
            $_SESSION["error"]["message"][] = "Customer passwords do not match.";
            $_SESSION["error"]["password-error"] = 1;
            $_SESSION["error"]["password_confirm-error"] = 1;
        }
    }
    /*
Exemplo n.º 2
0
 function customer_portal_auth($id_customer, $code_customer, $password_plaintext)
 {
     log_debug("customers", "Executing customer_portal_auth({$id_customer}, {$code_customer}, *plaintextpassword*)");
     if (user_permissions_get("customers_portal_auth")) {
         $obj_customer = new customer_portal();
         /*
         	Load SOAP Data
         */
         $data["id"] = @security_script_input_predefined("int", $id_customer);
         $data["code_customer"] = @security_script_input_predefined("any", $code_customer);
         $data["password_plaintext"] = @security_script_input_predefined("any", $password_plaintext);
         foreach (array_keys($data) as $key) {
             if ($data[$key] == "error" && $data[$key] != 0) {
                 throw new SoapFault("Sender", "INVALID_INPUT ");
             }
         }
         /*
         	Fetch & verify ID
         */
         if (!$data["id"]) {
             // verify the supplied customer code and fetch the ID from it
             $sql_obj = new sql_query();
             $sql_obj->string = "SELECT id FROM customers WHERE code_customer='" . $data["code_customer"] . "' LIMIT 1";
             $sql_obj->execute();
             if ($sql_obj->num_rows()) {
                 $sql_obj->fetch_array();
                 $obj_customer->id = $sql_obj->data[0]["id"];
             } else {
                 throw new SoapFault("Sender", "INVALID_AUTHDETAILS");
             }
         } else {
             // use supplied ID
             $obj_customer->id = $data["id"];
             // verify valid ID
             if (!$obj_customer->verify_id()) {
                 throw new SoapFault("Sender", "INVALID_AUTHDETAILS");
             }
         }
         /*
         	Verify Password
         */
         if ($obj_customer->auth_login($data["password_plaintext"])) {
             return $obj_customer->id;
         } else {
             throw new SoapFault("Sender", "INVALID_AUTHDETAILS");
         }
     } else {
         throw new SoapFault("Sender", "ACCESS DENIED");
     }
 }