/** * Fraternity events are displayed with three action buttons: * Updated, Delete, and Show PNMs. * This function is the form handler for all three. * This function is going to add an event for the passed $frat_letters * This function is called from ifcrush_frat with $frat_letters **/ function ifcrush_event_handle_form($frat_letters) { global $debug; if ($debug) { echo "[ifcrush_event_handle_form] {$frat_letters}"; echo "<pre>"; print_r($_POST); echo "</pre>"; } $thisevent = array('eventID' => isset($_POST['eventID']) ? $_POST['eventID'] : "", 'eventDate' => $_POST['eventDate'], 'title' => $_POST['eventTitle'], 'fratID' => $frat_letters); // put the form input into an array switch ($_POST['action']) { case "Update Event": updateEvent($thisevent); break; case "Delete Event": deleteEvent($thisevent); break; case "Add Event": addEvent($thisevent); break; default: echo "[ifcrush_event_handle_form]: bad action"; } }
public function delete() { $error = false; $error |= deleteEvent($this->id); if (!@is_null($this->imagePath)) { $error |= unlink($this->imagePath); } return $error; }
function handlePostRequest($type, $eventid) { $data = json_decode(file_get_contents('php://input')); $write = array(); if (lockDatabase() !== FALSE) { if ($type != 'addroute') { $loggedIn = logIn($data); } else { // don't need to log in to add a route $loggedIn = TRUE; } if ($loggedIn) { //rg2log($type); switch ($type) { case 'addroute': $write = addNewRoute($eventid, $data); @unlink(CACHE_DIRECTORY . "results_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "tracks_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "stats.json"); break; case 'addmap': $write = addNewMap($data); break; case 'createevent': $write = addNewEvent($data); @unlink(CACHE_DIRECTORY . "events.json"); @unlink(CACHE_DIRECTORY . "stats.json"); break; case 'editevent': $write = editEvent($eventid, $data); @unlink(CACHE_DIRECTORY . "events.json"); @unlink(CACHE_DIRECTORY . "stats.json"); break; case 'deleteevent': $write = deleteEvent($eventid); @unlink(CACHE_DIRECTORY . "events.json"); @unlink(CACHE_DIRECTORY . "results_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "courses_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "tracks_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "stats.json"); break; case 'deleteroute': $write = deleteRoute($eventid); @unlink(CACHE_DIRECTORY . "results_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "tracks_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "stats.json"); break; case 'deletecourse': $write = deleteCourse($eventid); @unlink(CACHE_DIRECTORY . "results_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "courses_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "tracks_" . $eventid . ".json"); @unlink(CACHE_DIRECTORY . "stats.json"); break; case 'login': // handled by default before we got here $write["ok"] = TRUE; $write["status_msg"] = "Login successful"; break; default: rg2log("Post request not recognised: " . $type); $write["status_msg"] = "Request not recognised: " . $type; $write["ok"] = FALSE; break; } } else { $write["ok"] = FALSE; $write["status_msg"] = "Incorrect user name or password"; } unlockDatabase(); } else { $write["status_msg"] = "File lock error"; $write["ok"] = FALSE; } $keksi = generateNewKeksi(); $write["keksi"] = $keksi; header("Content-type: application/json"); $write["version"] = RG2VERSION; echo json_encode($write); }
} switch ($_GET['action']) { case 'start': getEvents(); break; case 'add': addEvent(); break; case 'update': updateEvent(); break; case 'resize': resizeEvent(); break; case 'del': deleteEvent(); break; case 'get_cal': getCalendar(); break; case 'mail_event': mailEvent(); break; default: break; } function addEvent() { global $error; $order_id = $_SESSION['order_id']; $color = DEFAULT_COLOR;
} // This is the important stuff dbQuery("delete from Monitors where Id = ?", array($markMid)); dbQuery("delete from Zones where MonitorId = ?", array($markMid)); if (ZM_OPT_X10) { dbQuery("delete from TriggersX10 where MonitorId=?", array($markMid)); } fixSequences(); // If fast deletes are on, then zmaudit will clean everything else up later // If fast deletes are off and there are lots of events then this step may // well time out before completing, in which case zmaudit will still tidy up if (!ZM_OPT_FAST_DELETE) { // Slight hack, we maybe should load *, but we happen to know that the deleteEvent function uses Id and StartTime. $markEids = dbFetchAll("SELECT Id,StartTime FROM Events WHERE MonitorId=?", NULL, array($markMid)); foreach ($markEids as $markEid) { deleteEvent($markEid, $markMid); } deletePath(ZM_DIR_EVENTS . "/" . basename($monitor['Name'])); deletePath(ZM_DIR_EVENTS . "/" . $monitor['Id']); // I'm trusting the Id. } } } } } } } // Device view actions if (canEdit('Devices')) { if ($action == "device") { if (!empty($_REQUEST['command'])) {
<?php require_once 'init.php'; //listens for what is sent through the link //this page's only job is to receive items - kind of like a directory if (isset($_GET['caller_id'])) { $dir = $_GET['caller_id']; if ($dir == "logout") { logged_out(); } else { if ($dir == "deleteuser") { $id = $_GET['id']; deleteUser($id); } else { if ($dir == "deletenews") { $id = $_GET['id']; deleteNews($id); } else { if ($dir == "deleteevent") { $id = $_GET['id']; deleteEvent($id); } else { //remove for when files go live echo "Caller id was passed incorrectly."; } } } } }
<?php session_start(); include_once "database/events.php"; $id = $_GET['id']; $event = getEvent($id); if (isset($_SESSION['username'])) { if ($_SESSION['username'] == 'admin' || $_SESSION['username'] == $event['creator']) { deleteEvent($id, $_SESSION['username']); } } header('Location: ' . './list_events.php');
// Vérifie qu'il n'y a pas des champs en trop ou en moins. $champsAttendus = array('titre'); foreach ($_POST as $cle => $valeur) { if (!in_array($cle, $champsAttendus)) { unset($_POST[$cle]); } elseif (!isset($_POST[$cle])) { $_POST[$cle] = ""; } else { $_POST[$cle] = htmlspecialchars($_POST[$cle]); } } if ($_POST['titre']) { // Le champ est rempli if ($_POST['titre'] == $contents['values']['titre']) { // Destruction de l'event if (deleteEvent($_GET['id'])) { } else { $errorMessage = "Une erreur s'est produite dans la suppression de l'évènement. Merci de réessayer !"; } // Si le message d'erreur est resté vide if (!$errorMessage) { // Sortie du script et redirection vers la page précédant la connexion : alert('info', 'Vous avez bien supprimé cet évènement.'); header('Location: ' . getLink(['accueil'])); exit; } } else { $errorMessage = "Le titre saisi est incorrect !"; } } else { $errorMessage = 'Merci de renseigner le nom de l\'évènement.';
if (isset($_POST['method'])) { $method = $_POST['method']; } if (isset($_POST['file'])) { $file = $path . $_POST['file']; } if (isset($_GET['id'])) { $file = $path . $_GET['event']; deleteEvent($file, $_GET['id']); } if ($method == 'saveEvent') { saveEvent($file); } else { if ($method == 'deleteEvent') { $url = filter_input(INPUT_POST, 'url'); deleteEvent($file, $url); } } function saveEvent($file) { $eventJSON = filter_input(INPUT_POST, 'json'); $to = filter_input(INPUT_POST, 'email'); $deleteUrl = filter_input(INPUT_POST, 'deleteUrl'); $username = filter_input(INPUT_POST, 'username'); $email = '*****@*****.**'; $subject = "Thank you for creating event"; $message = "\nHello {$username},<br/>\nYou have successfully created an event! To remove the event click on the following link:<br/><br/>\n<a href='{$deleteUrl}'>{$deleteUrl}</a><br/><br/>\nBest Regards,<br/>\nTeam Rookies"; $headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'Content-Type:text/html; charset=UTF-8' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); header('Content-Type: application/json'); if (mail($to, $subject, $message, $headers)) { file_put_contents($file, $eventJSON);
changeEvent($mysql, $userId, $_POST['eventId']); break; case 'eventUpInCat': eventUpInCat($mysql, $_POST['eventId'], $userId); break; case 'eventUpInAllCat': eventUpInAllCat($mysql, $_POST['eventId'], $userId); break; case 'eventPause': eventPause($mysql, $userId, $_POST['eventId']); break; case 'eventFreeze': eventFreeze($mysql, $userId, $_POST['eventId']); break; case 'deleteEvent': deleteEvent($mysql, $userId, $_POST['eventId']); break; case 'deleteSpot': deleteSpot($mysql, $userId, $_POST['spotId']); break; case 'adminUserbaseEdit': adminUserbaseEdit($mysql, $userId); break; case 'adminEventFreeze': adminEventFreeze($mysql, $userId, $_POST['eventId']); break; case 'tariffConfirm': tariffConfirm($mysql, $userId); break; case 'tariffOrder': tariffOrder($mysql, $userId);
$task = createEvent($eventname, $startdate, $enddate, $userid, $capacity, $displaycapacity); } else { $task = updateEvent($eventname, $startdate, $enddate, $userid, $capacity, $displaycapacity, $eventid); } if (!$task) { $data = array("success" => false, "message" => "Error!"); } else { $data = array("success" => true, "message" => "Success!", "id" => $task); } echo json_encode($data); } //saveevent if (isset($_POST['deleteEvent']) && !$cancelProcess) { $userid = $_SESSION['UserID']; $eventid = $_POST['eventid']; $task = deleteEvent($userid, $eventid); if (!$task) { $data = array("success" => false, "message" => "Error!"); } else { $data = array("success" => true, "message" => "Success!"); } echo json_encode($data); } //deleteEvent if (isset($_POST['geteventinfo']) && !$cancelProcess) { $eventid = $_POST['eventid']; $userid = $_SESSION['UserID']; $data = getEventInfo($eventid, $userid); $data = array("success" => true, "message" => "Success!", "capacity" => $data->capacity, "startdate" => $data->startdate, "eventname" => $data->eventname, "eventid" => $data->eventid, "enddate" => $data->enddate, "displaycapacity" => $data->displaycapacity); echo json_encode($data); }
} if (isset($_GET['delete'])) { $User = $Model->recupUser($_GET['delete']); if ($_SESSION['rang'] <= $User->rang) { echo "<div class='error' >Suppression Impossible !</div>"; } else { deleteUser($_GET['delete']); header('Location : index.php?page=admin&supprimer=User'); } } if (isset($_GET['deleteNews'])) { deleteNews($_GET['deleteNews']); header('Location : index.php?page=admin&supprimer=News'); } if (isset($_GET['deleteEvent'])) { deleteEvent($_GET['deleteEvent']); header('Location : index.php?page=admin&supprimer=Event'); } /******************************************************/ /* Forum Gestion */ /******************************************************/ $listeCategorie = recupCategories(); $listeForum = recupForum(); function checkCategorie() { if (isCategorieInDb($_POST['nom'])) { return "Categorie déjà utilisé, merci d'en choisir un autre."; } return "NoError"; } if (isset($_POST['creerCat'])) {
$max = $event["max_attendees"]; } if ($_SERVER["REQUEST_METHOD"] == "POST") { // process the event change if (password_verify($_POST["admin-password"], $admin["password"])) { if ($_POST["action"] == "delete") { $registrations = deleteEvent($event["event_id"]); foreach ($registrations as $registration) { // refund the charge if (!empty($registration["stripe_charge_id"])) { $refund = \Stripe\Refund::create(array("charge" => $registration["stripe_charge_id"])); } // unregister the user unregisterUser($registration["event_id"], $registration["user_id"]); } deleteEvent($event["event_id"], true); $_SESSION["deleted"] = $event["name"]; header("Location:/admin/events/"); } elseif ($_POST["action"] == "edit") { $edit = editEvent($event["event_id"], $_POST["name"], str_replace(array("\r\n", "\r", "\n"), "<br>", $_POST["description"]), $_POST["date"], $_POST["start-time"], $_POST["end-time"], $_POST["member-price"], $_POST["nonmember-price"], $_POST["max"]); var_dump($edit); $_SESSION["event-edited"] = true; header("Location:/admin/events/edit/" . $event["event_id"] . "/"); } } else { $_SESSION["incorrect-password"] = true; header("Location:/admin/events/edit/" . $event["event_id"] . "/"); } } else { ?> <html>
out(null, 'You must supply a valid start and end date'); } break; case 'add': if (isset($event)) { // The id column is auto-increment, so remove if passed in unset($event['id']); $result = addEvent($event); } out($result); break; case 'update': if (isset($event)) { $result = updateEvent($event); } out($result); break; case 'delete': if (isset($event)) { $result = deleteEvent($event); } if ($result === 1) { // Return the deleted id instead of row count $result = $event['id']; } out($result); break; } } catch (Exception $e) { handleException($e); }
<?php function deleteEvent($eventID) { require_once 'conn.php'; $sql = "DELETE FROM `events` where id=:id"; try { $sth = $dbh->prepare($sql); $sth->execute(array(":id" => $eventID)); } catch (PDOException $e) { echo "delete from db failed: " . $e->getMessage(); } $dbh = null; return array('result' => 'successfully deleted event ' . $eventID); } $res = deleteEvent(htmlspecialchars($_GET["id"])); header('Content-Type: text/json'); echo json_encode($res);
zmcControl($monitor, "stop"); } // This is the important stuff dbQuery("delete from Monitors where Id = ?", array($markMid)); dbQuery("delete from Zones where MonitorId = ?", array($markMid)); if (ZM_OPT_X10) { dbQuery("delete from TriggersX10 where MonitorId=?", array($markMid)); } fixSequences(); // If fast deletes are on, then zmaudit will clean everything else up later // If fast deletes are off and there are lots of events then this step may // well time out before completing, in which case zmaudit will still tidy up if (!ZM_OPT_FAST_DELETE) { $markEids = dbFetchAll("select Id from Events where MonitorId=?", 'Id', array($markMid)); foreach ($markEids as $markEid) { deleteEvent($markEid); } deletePath(ZM_DIR_EVENTS . "/" . basename($monitor['Name'])); deletePath(ZM_DIR_EVENTS . "/" . $monitor['Id']); // I'm trusting the Id. } } } } } } } // Device view actions if (canEdit('Devices')) { if ($action == "device") { if (!empty($_REQUEST['command'])) {
* * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. Redistributions in binary * form must reproduce the above copyright notice, this list of conditions and * the following disclaimer in the documentation and/or other materials * provided with the distribution. Neither the name of the University of * Massachusetts Lowell nor the names of its contributors may be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ require_once '../includes/config.php'; if (isset($_GET['action'])) { switch ($_GET['action']) { case "delete": deleteEvent($_GET['id']); echo "worked!"; break; } }
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // $Id: editSched.php,v 1.17 2006/02/03 20:24:34 atrommer Exp $ checkUser($_SESSION['USERTYPE'], 2); // get the area attributes $oAreaDetails = getAreas($_SESSION['USERID'], $_REQUEST['area']); // make sure a row is returned, if not, user is being bad if (!count($oAreaDetails)) { // no areas, tried to circumvent sec, yell at them accessDenied("You tried to access an area you aren't assigned to!"); } elseif (!$_REQUEST['area']) { // force people through assignEmps accessDenied("Please choose an area to edit first through Manage Schedules"); } if ($_POST['confirmDelete']) { deleteEvent($_POST['event']); redirect("editSched.php?area=" . $_POST['area']); } function deleteConfirm($iArea, $iEvent) { $aEventDetails = getEventDetails($iEvent); ?> <form id="frmDelete" name="frmDelete" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="hidden" name="area" value="<?php echo $iArea; ?> "> <input type="hidden" name="event" value="<?php
} break; } } if (canEdit('Events')) { switch ($_REQUEST['action']) { case "rename": if (!empty($_REQUEST['eventName'])) { dbQuery('UPDATE Events SET Name = ? WHERE Id = ?', array($_REQUEST['eventName'], $_REQUEST['id'])); } else { ajaxError("No new event name supplied"); } ajaxResponse(array('refreshEvent' => true, 'refreshParent' => true)); break; case "eventdetail": dbQuery('UPDATE Events SET Cause = ?, Notes = ? WHERE Id = ?', array($_REQUEST['newEvent']['Cause'], $_REQUEST['newEvent']['Notes'], $_REQUEST['id'])); ajaxResponse(array('refreshEvent' => true, 'refreshParent' => true)); break; case "archive": case "unarchive": $archiveVal = $_REQUEST['action'] == "archive" ? 1 : 0; dbQuery('UPDATE Events SET Archived = ? WHERE Id = ?', array($archiveVal, $_REQUEST['id'])); ajaxResponse(array('refreshEvent' => true, 'refreshParent' => false)); break; case "delete": deleteEvent($_REQUEST['id']); ajaxResponse(array('refreshEvent' => false, 'refreshParent' => true)); break; } } ajaxError('Unrecognised action or insufficient permissions');
public function actionEventshead() { global $urlRequestRoot, $sourceFolder, $templateFolder, $cmsFolder, $moduleFolder; $moduleComponentId = $this->moduleComponentId; $userId = $this->userId; require_once "{$sourceFolder}/{$moduleFolder}/events/events_common.php"; require_once "{$sourceFolder}/{$moduleFolder}/events/events_forms.php"; if (isset($_POST['type'])) { if ($_POST['type'] == 'add') { validateAddEventData($moduleComponentId); } else { if ($_POST['type'] == 'edit') { validateEditEventData($moduleComponentId); } else { if ($_POST['type'] == "notif") { $query = "INSERT INTO `events_notifications` VALUES (NULL, '{$_POST['content']}', CURRENT_TIMESTAMP);"; //echo NOW(); mysql_query($query); // header('Location: ./+eventsHead'); // } } } exit; } if (isset($_GET['subaction'])) { if ($_GET['subaction'] == "addEvent") { return addNewEvent(); } if ($_GET['subaction'] == "deleteEvent") { return deleteEvent($_POST['eventId'], $moduleComponentId); exit; } if ($_GET['subaction'] == "editEvent") { return editEvent($_GET['eventId'], $moduleComponentId); } if ($_GET['subaction'] == "notif") { //return ":LL"; return getEventsForm(); } } else { return selectEventsHeadSubaction($moduleComponentId); } }
case "PUT": if ($request_obj->account_priv == "Officer" or $request_obj->account_priv == "Admin") { updateEvent($request_obj); } $cal_obj = new EventCalendar($request_obj); echo $cal_obj->createTable(); break; case "GET": $event_day = new EventDay($request_obj); $event = getEventInfo($request_obj); $event_day->fillEventInfo($event); echo $event_day->displayEvent(); break; case "DELETE": if ($request_obj->account_priv == "Officer" or $request_obj->account_priv == "Admin") { deleteEvent($request_obj); } $cal_obj = new EventCalendar($request_obj); echo $cal_obj->createTable(); break; } break; case "blankForm": $event_day = new EventDay($request_obj); echo $event_day->createEventForm(); break; } function createNewEvent($request_obj) { $up_array[':title'] = $_REQUEST['event_title']; $up_array[':date'] = $_REQUEST['event_date'];
<?php if (isset($_POST["envoyer"]) and isset($_POST['dateEvent']) and strlen($_POST['dateEvent']) != 0) { $dateEvent = $_POST['dateEvent']; deleteEvent($dateEvent); ?> <section class="slice bg-3"> <div class="w-section inverse"> <div class="container"> <div class="row"> <div class="col-md-7"> <p>Information :</p> <ul class="list-check"> <li><i class="fa fa-check"></i> L'album a bien été supprimé !</li> </ul> </div> </div> </div> </div> </section> <?php } else { ?> <section class="slice bg-3"> <div class="w-section inverse"> <div class="container"> <div class="row"> <div class="col-md-6 col-md-offset-3 col-sm-6 col-sm-offset-3"> <div class="w-section inverse"> <div class="w-box sign-in-wr bg-5">
submitEventData(); break; case "edit": $id = (int) $_GET['id']; if (!empty($id)) { submitEventData($id); } else { $lang['accesswarning']; } break; case "delete": $month = (int) $_GET['month']; $year = (int) $_GET['year']; $id = (int) $_GET['id']; if (!(empty($id) && empty($month) && empty($year))) { deleteEvent($id, $month, $year); } else { $lang['accesswarning']; } break; default: $lang['accesswarning']; } } else { echo $lang['accessdenied']; } function submitEventData($id = "") { global $lang; $uid = $_POST['uid']; $title = addslashes($_POST['title']);
<?php if (isset($_POST['Delete_button'])) { $event_to_delete = $_POST['Delete_button']; if (existsEventByID($event_to_delete) && $_SESSION['csrf'] == $_POST['csrf']) { $event_name = deleteEvent($event_to_delete); } }
<? include_once('../database/eventFunc.php'); try { $event = deleteEvent($_POST['name']); if ($event === false){ echo "failed_to_delete_event"; } else if ($event === true){ echo "success"; } } catch (PDOException $e) { die($e->getMessage()); } ?>
// Huidige tijd $curdate = time(); $curday = date('d', $curdate); $curmonth = date('m', $curdate); $curyear = date('Y', $curdate); $curhour = date('H', $curdate); $curhour = $curhour + 1; $curhour = sprintf("%02s", $curhour); $snoozehour = date('H', $curdate); $snoozehour = $snoozehour + 2 + $_POST['hour']; $snoozehour = sprintf("%02s", $snoozehour); $curminute = date('i', $curdate); $cursecond = date('s', $curdate); $curtime = $curhour . ':' . $curminute . ':' . $cursecond; $snoozetime = $snoozehour . ':' . $curminute . ':' . $cursecond; ?> <section class="index"> <div class="thisday"> <ul class="line-through"> <?php seeBeforeDeleted($curday, $curmonth, $curyear, $curtime, $snoozetime, $userID); ?> </ul><ul><li> <?php deleteEvent($curday, $curmonth, $curyear, $curtime, $snoozetime, $userID); ?> </li></ul> </div>
</div> <!-- /.navbar-static-side --> </nav> <!-- Page Content --> <div id="page-wrapper"> <div class="container-fluid"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Manage Calendar Events</h1> <a href="addEvent.php" class="btn btn-primary"><i class="fa fa-plus"></i> Add Event</a> <p> <?php include "../../databaseInfo.php"; if (isset($_POST["calendarID"]) && isset($_POST["eventName"])) { if (deleteEvent($_POST["calendarID"])) { generatePage("success", $_POST["eventName"]); } else { generatePage("fail", $_POST["eventName"]); } } else { generatePage("", ""); } function deleteEvent($eventID) { try { $connection = new PDO("mysql:host=" . DB_HOST_NAME . ";dbname=" . DB_NAME . ";charset=utf8", DB_USER_NAME, DB_PASSWORD); // Exceptions fire when occur $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $accountInformationQuery = $connection->query(' DELETE FROM ' . CALENDAR_TABLE . '
//source: http://us2.php.net/manual/en/mysqli.quickstart.prepared-statements.php $mysqli = new mysqli("oniddb.cws.oregonstate.edu", "johnsjo3-db", $ecret, "johnsjo3-db"); if ($mysqli->connect_errno) { printError("Failed to connect to database (" . $mysqli->connect_errno . ") " . $mysqli->connect_error); } else { array_push($statusArr, "Successfully connected to database"); } //Switch to handle request if ($requestMethod == "GET") { if (isset($_GET['action'])) { switch ($_GET['action']) { case 'loadEvents': loadEvents($mysqli); break; case 'deleteEvent': deleteEvent($mysqli); break; case 'editEvent': editEvent($mysqli); break; case 'getUserName': getUserName(); break; case 'newEvent': newEvent($mysqli); break; default: printError("Invalid Action Request"); break; } }
<?php session_start(); require_once "../../inc/config.php"; require_once ROOT_PATH . "inc/database.php"; include ROOT_PATH . "inc/header.php"; // TODO: clean $_GET["event_id"]; $event = getEvent($_GET["event_id"]); $admin = getUser($_SESSION["user_id"]); if ($_SERVER["REQUEST_METHOD"] == "POST") { // process the event deletion if (password_verify($_POST["admin_password"], $admin["password"])) { deleteEvent($event["event_id"]); $_SESSION["delete"] = true; } else { $_SESSION["incorrect-password"] = true; } header("Location:/admin/events/delete/" . $event["event_id"]); } else { ?> <html> <?php include ROOT_PATH . "inc/head.php"; ?> <body> <div class="wrapper content"> <div class="row"> <nav class="col-20"> <ul class="side-nav"> <li><a href="/admin/users/">User Accounts</a></li> <li class="selected">
session_start(); } checkIfLogged(); include_once './funcs.php'; include_once './API/georeferencingAccess.php'; include_once './API/calendarAccess.php'; parse_str($_SERVER['QUERY_STRING']); $json = getProfiles(); $profiles = json_decode($json); //file_put_contents("testPost","clean\n"); //$profileID = //atribuido no index //get them tokens $calendarToken = getServerAccess("calendar"); $geoRefToken = getServerAccess("georeferencing"); //check if post if ($_SERVER['REQUEST_METHOD'] != "DELETE") { header("HTTP/1.0 404 Not Found"); die("Only Deletes\n"); } $result = deleteEvent($calendarToken, $profileID, $eventID); removeFence($geoRefToken, $profileID, $fenceID); /* file_put_contents("1testDelete1", "calendarToken :" . $calendarToken . "\n" . "geoRefToken : " . $geoRefToken . "\n" . "profileID : " . print_r($profileID, TRUE) . "\n" . "eventID : " . print_r($eventID, TRUE) . "\n" . "fenceID : " . print_r($fenceID, TRUE) . "\n" . "event result : " . $result . "\n". "#\n" ); */