$header = array('Authorization' => $_SESSION['token'], 'Content-Type' => 'application/json', 'Accept' => 'application/json'); $response = $client->fetch($baseApiUrl . '/api/v1/people/' . $details['id'], json_encode($params), 'PUT', $header, 0); header('Location: index.php'); } function update_event($details) { global $client, $baseApiUrl, $baseSiteSlug; $params = array('event' => array('name' => $details['name'], 'status' => $details['status'], 'start_time' => $details['start_time'], 'end_time' => $details['end_time'])); $header = array('Authorization' => $_SESSION['token'], 'Content-Type' => 'application/json', 'Accept' => 'application/json'); $response = $client->fetch($baseApiUrl . '/api/v1/sites/' . $baseSiteSlug . '/pages/events/' . $details['id'], json_encode($params), 'PUT', $header, 0); header('Location: index.php'); } function delete_person($id) { global $client, $baseApiUrl; $response = $client->fetch($baseApiUrl . '/api/v1/people/' . $id, array(), 'DELETE'); header('Location: index.php'); } if (isset($_GET['create']) && $_GET['create'] == 'create') { create_person($_GET); } elseif (isset($_GET['update']) && $_GET['update'] == 'update') { update_person($_GET); } elseif (isset($_GET['delete'])) { delete_person($_GET['delete']); } elseif (isset($_GET['updateEvent'])) { if (isset($_GET['id'])) { update_event($_GET); } else { create_event($_GET); } }
<?php // configuration require "../includes/directory_functions.php"; // delete the person if (delete_person($_GET['id']) === false) { apologize("There was an error deleting the entry"); } // redirect to home page redirect("/");
<?php $id = htmlspecialchars($_GET["id"]); function delete_person($id) { include 'dbconnect.php'; $query = "Delete FROM Person WHERE id='" . $id . "'"; $result = mysqli_query($connection, $query); if ($result) { echo "ok"; } else { echo "nicht ok"; } } function delete_notes($person_id) { include 'dbconnect.php'; $query = "Delete FROM Notiz WHERE person_id='" . $person_id . "'"; $result = mysqli_query($connection, $query); if ($result) { echo "ok"; } else { echo "nicht ok"; } } delete_person($id); delete_notes($id);
// Check for a valid user ID, through GET or POST $user_id = $_GET['user_id']; } elseif (isset($_POST['user_id']) && is_numeric($_POST['user_id'])) { // Form submission $user_id = $_POST['user_id']; } else { // No valid ID, kill the script echo '<p class="error">This page has been accessed in error.</p>'; include 'include/footer.html'; exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Check if the form has been submitted if ($_POST['sure'] == 'Yes') { // Delete the record $r =& delete_person($user_id); // Query in data_functions.php if (mysqli_affected_rows($dbc) == 1) { // If it ran OK redirect_user($page); // Go back to admin page } else { // If the query did not run OK echo '<p class="error">The user could not be deleted due to a system error.</p>'; // Public message echo '<p>' . mysqli_error($dbc) . '<br />Query: ' . $q . '</p>'; // Debugging message } } else { // No confirmation of deletion redirect_user($page);
function update($update) { if (isset($update['update'])) { for ($i = 1; $i <= floor(count($update) / 8) + 1; $i++) { if (!$update['del' . $i]) { add_personal_date($update['Name' . $i], $update['Surname' . $i], $update['Age' . $i], $update['key' . $i]); $cat_id = get_id_by_name('Categories', $update['Category' . $i]); add_person_cat($update['key' . $i], $cat_id); $subjs = get_subjects(); foreach ($subjs as $id => $name) { add_person_mark($update['key' . $i], $id, $update[$i . 'subj' . $id]); } } else { delete_person($update['key' . $i]); } } echo "<p>Dates updated successfully!</p>"; } }
} $sel2 .= "</select>"; } else { $sel2 = ''; } echo $sel . $sel2; } } if ($_GET['what'] == 'delete_build') { delete_build($_GET['build_id']); } if ($_GET['what'] == 'delete_asoc') { delete_asoc($_GET['asoc_id']); } if ($_GET['what'] == 'delete_person') { delete_person($_GET['person_id']); } } /* **************************************************************************************************************** */ if ($_GET['file'] == 'regCard') { $sql1 = "SELECT `name`, address, phone, type \n\t\t\t\t FROM people \n\t\t\t\t WHERE asoc_id = '" . $_GET['a_id'] . "' and invalid='0'"; $res1 = mysql_query($sql1) or die(mysql_error()); $table = "<table id='the_table'>"; while ($row1 = mysql_fetch_assoc($res1)) { if ($row1['type'] == 1) { $table .= "<tr><td align='center'>Управител:</td></tr>"; $table .= "<tr><td>" . $row1['name'] . ", " . $row1['address'] . ", " . $row1['phone'] . "</td></tr>"; } if ($row1['type'] == 2) { $table .= "<tr><td align='center'>Контрольор:</td></tr>"; $table .= "<tr><td>" . $row1['name'] . ", " . $row1['address'] . ", " . $row1['phone'] . "</td></tr>";
//------------------------------------------------------------------------------ case 'deleteperson': if (PGV_DEBUG) { phpinfo(INFO_VARIABLES); echo "<pre>{$gedrec}</pre>"; } if (!checkFactEdit($gedrec)) { echo "<br />", $pgv_lang["privacy_prevented_editing"]; if (!empty($pid)) { echo "<br />", $pgv_lang["privacy_not_granted"], " pid {$pid}."; } if (!empty($famid)) { echo "<br />", $pgv_lang["privacy_not_granted"], " famid {$famid}."; } } else { if (delete_person($pid, $gedrec)) { echo "<br /><br />", $pgv_lang["gedrec_deleted"]; } } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case 'deletefamily': if (PGV_DEBUG) { phpinfo(INFO_VARIABLES); echo "<pre>{$gedrec}</pre>"; } if (!checkFactEdit($gedrec)) { echo "<br />", $pgv_lang["privacy_prevented_editing"]; if (!empty($pid)) { echo "<br />", $pgv_lang["privacy_not_granted"], " pid {$pid}.";