/** * page code function */ function ThisPageMainCode() { global $logged; $ret = ""; $member['ID'] = (int) $_COOKIE['memberID']; $owner = $_REQUEST['owner'] ? (int) $_REQUEST['owner'] : (int) $_COOKIE['memberID']; // Check if membership allows this action $check_res = checkAction($member['ID'], ACTION_ID_VIEW_GUESTBOOK); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$logged['admin'] && $member['ID'] != $owner) { $ret .= "<br />\r\n\t\t\t<table width=\"100%\" cellpadding=1 cellspacing=1 border=0>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=text align=center>\r\n\t\t\t\t\t\t<br />" . $check_res[CHECK_ACTION_MESSAGE] . "<br />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\n"; return $ret; } $check_res = checkAction($owner, ACTION_ID_USE_GUESTBOOK); if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED && !$logged['admin']) { $ret .= $member['ID'] == $owner ? $check_res[CHECK_ACTION_MESSAGE] : _t_err("_This guestbook disabled by it's owner"); return $ret; } if ($_GET['action'] == 'show_add' && $_GET['owner']) { $ret .= ShowAddRecord(); return $ret; } if ($_POST['action'] == 'new' && $_POST['owner'] && strlen($_POST['newrecord'])) { $ret .= AddRecord(); } if ($_GET['action'] == 'delete' && $_GET['owner'] && (int) $_GET['delete_id'] != 0) { $ret .= DeleteRecord(); } $ret .= PrintGuestbook(); return $ret; }
//Delete room record from the room table $host = "localhost"; // Host name $username = "******"; // Mysql username $password = "******"; // Mysql password $db_name = "coderdojo"; // Database name // Create connection $conn = mysqli_connect($host, $username, $password, $db_name); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } //Passed Data $postdata = file_get_contents("php://input"); $RoomID = $postdata; DeleteRecord($conn, $RoomID); //Deleting room record function DeleteRecord($conn, $RoomID) { $sql = "DELETE FROM room WHERE RoomID={$RoomID};"; if (mysqli_query($conn, $sql)) { return true; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } mysqli_close($conn);
function DeleteParcel() { $table = SelectTable(); DeleteRecord($table, 'id = "' . $_REQUEST['pid'] . '"'); }
// Mysql password $db_name = "coderdojo"; // Database name // Create connection $conn = mysqli_connect($host, $username, $password, $db_name); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } //Passed Data $postdata = file_get_contents("php://input"); $request = json_decode($postdata); $BookingID = $request->BookingID; $CourseID = $request->CourseID; if (UpdateTickets($CourseID, $conn)) { if (DeleteRecord($conn, $BookingID)) { echo "Success"; } else { echo "Fail Delete Record"; } } else { echo "Fail Update Tickets"; } //Increase the amount of available tickets when cancelling booking function UpdateTickets($CourseID, $conn) { $sql = "UPDATE course SET AvailableTickets = AvailableTickets + 1 WHERE CourseID = {$CourseID}"; if (mysqli_query($conn, $sql)) { return true; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn);