case 1: $result = $a->save($_POST); if ($result != false) { if ($result == 1) { $result = "finCorrecto"; } } else { $result = "errorAlta"; } break; case 3: $result = $a->editarPersona($_POST); if ($result != false) { $result = "finCorrecto"; } else { $result = "errorUpdate"; } break; case 2: $result = $a->delete($_POST['id']); if ($result) { $result = "finCorrecto"; } else { $result = "errorBorrar"; } break; default: break; } echo $result; }
try { $persona->load($persona_id); } catch (PAException $e) { // this is usually because the Persona has already been deleted // and thus doen't exist Logger::log("ERROR: trying to delete Persona: " . $persona_id . "\n" . $e->getMessage()); $msg = "Couldn't disconnect the Service.<br />" . $e->getMessage(); // we do not throw this } if ($persona->user_id) { // check if Persona belongs to user if ($persona->user_id != $user->user_id) { $msg = "Couldn't disconnect the Service.<br />It is not associated with your account"; } else { // ok, let's kill it Persona::delete($persona_id); $msg = "The service has been successfully disconnected."; } } } if (@$_POST['profile_type'] == 'external') { global $msg; // so it will be seen in page creation context // let's see if this is a configure_XYZ call $config_call = false; foreach ($_POST as $k => $v) { if (preg_match('/^configure_/', $k)) { $config_call = $k; } } if ($config_call) {
<?php session_start(); require_once '../../twig/lib/Twig/Autoloader.php'; require_once '../../../Model/BinDb.php'; require_once '../../../Model/Persona.php'; if ($_SESSION['logeado'] == "Si") { if (isset($_POST['codigo_persona'])) { $codigo_persona = $_POST['codigo_persona']; if (!empty($codigo_persona)) { $aRespuesta = ['estado' => Persona::delete($codigo_persona)]; echo json_encode($aRespuesta); } } } else { header("Location: /Controller/partePublica/actividades.php"); }