123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
- //no index
- header("X-Robots-Tag: noindex, nofollow", true);
- //no caché
- header('Expires: Sun, 01 Jan 2014 00:00:00 GMT');
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- header('Cache-Control: no-store, no-cache, must-revalidate');
- header('Cache-Control: post-check=0, pre-check=0', false);
- header('Pragma: no-cache');
- date_default_timezone_set('America/Mexico_City');
- //header("Content-Type: text/xml; charset=UTF-8");
- require_once("../include/util.php");
- require_once("../include/nusoap/nusoap.php");
- require_once("../include/bd_pdo.php");
- define("PAG", "http://200.13.89.27/webservice/reposiciones_service");//pruebas
- $server = new soap_server();
- $server->configureWSDL("reposiciones_service", PAG);
- //Create a complex types
- function reposicion_autoriza($token, $id_repo, $salon){
-
- global $pdo;
- //$pass_hash = password_hash("W3bS3rv1c3.R3p0##", PASSWORD_DEFAULT);
- $ok = true;
- $rep_id = 0;
- $resultMsg = "Ocurrió un error al crear la reposición";
- if(!password_verify("W3bS3rv1c3.R3p0##", $token)){
- $array = array("result"=>false, "result_msg"=>"Token de conexión inválido");
- return $array;
- }
-
- try{
- $stmt = $pdo->prepare('SELECT * from fu_reposicion_autoriza(:id,:salon, 5)');//estado 5 aprobado
- $stmt->bindParam(":id", $id_repo);
- $stmt->bindParam(":salon", $salon);
- if(!$stmt->execute()){
- $resultMsg = "Error al autorizar la reposición";
- $ok = false;
- }else{
- $resultMsg = "La reposición se actualizó correctamente";
- }
- $stmt->closeCursor();
- }catch(Exception $e){
- $resultMsg = "Ocurrió un error al actualizar la reposición".$e->getMessage();
- $ok = false;
- }
-
- $array = array("result"=>$ok, "result_msg"=>$resultMsg);
- return $array;
- }
- function reposicion_rechaza($token, $id_repo, $motivo){
-
- global $pdo;
- //$pass_hash = password_hash("W3bS3rv1c3.R3p0##", PASSWORD_DEFAULT);
- $ok = true;
- $rep_id = 0;
- $resultMsg = "Ocurrió un error al crear la reposición";
- if(!password_verify("W3bS3rv1c3.R3p0##", $token)){
- $array = array("result"=>false, "result_msg"=>"Token de conexión inválido");
- return $array;
- }
- try{
- $stmt = $pdo->prepare('SELECT * from fu_reposicion_rechaza(:id,:motivo, 4)');//estado 4 rechazado
- $stmt->bindParam(":id", $id_repo);
- $stmt->bindParam(":motivo", $motivo);
- if(!$stmt->execute()){
- $resultMsg = "Error al rechazar la reposición";
- $ok = false;
- }else{
- $resultMsg = "La reposición se actualizó correctamente";
- }
- $stmt->closeCursor();
- }catch(Exception $e){
- $resultMsg = "Ocurrió un error al actualizar la reposición".$e->getMessage();
- $ok = false;
- }
-
- $array = array("result"=>$ok, "result_msg"=>$resultMsg);
- return $array;
- }
- // Parametros de salida
- $server->register("reposicion_autoriza",
- array("token" => "xsd:string", "reposicion" => "xsd:integer", "salon" => "xsd:string"),//recibe id reposicion y salón como texto
- array('result' => 'xsd:boolean', 'result_msg' => 'xsd:string'),//regresa
- PAG,
- PAG."#reposicion_autoriza",
- "rpc",
- "encoded",
- "Actualiza el salón de la resposición");
-
- $server->register("reposicion_rechaza",
- array("token" => "xsd:string", "reposicion" => "xsd:integer", "mensaje" => "xsd:string"),//recibe id reposicion y mensaje del motivo
- array('result' => 'xsd:boolean', 'result_msg' => 'xsd:string'),//regresa
- PAG,
- PAG."#checahorarios",
- "rpc",
- "encoded",
- "Rechaza la reposición y escribe el motivo");
- @$server->service(file_get_contents("php://input"));
- ?>
|