// enter here only from My Report selection, never from default report $sql = "DELETE FROM " . DBReports . " WHERE id = '" . $ReportID . "'"; $Result = DB_query($sql, $db, '', '', false, true); $sql = "DELETE FROM " . DBRptFields . " WHERE reportid = '" . $ReportID . "'"; $Result = DB_query($sql, $db, '', '', false, true); // Recreate drop down list and return to report home (handled in Cancel below) // Recreate drop down list and return to report home (handled in Cancel below) case RPT_BTN_CANCEL: if ($GoBackURL != '') { // then the cancel button needs to return to homepage header("Location: " . $GoBackURL); exit; } else { // return to report list page $DefReportList = GetReports($Def = true); $CustReportList = GetReports($Def = false); $Title = RPT_MENU; $IncludePage = 'forms/ReportsList.html'; } break; case RPT_BTN_SAVE: case RPT_BTN_REPLACE: if ($_POST['todo'] == 'Replace') { $AllowOverwrite = true; } else { $AllowOverwrite = false; } $success = SaveNewReport($ReportID, $AllowOverwrite); if ($success['result'] == 'success') { // Reload criteria page $ReportID = $success['ReportID'];
function SetWatchPeriod($loginState, $period) { $userId = $loginState['id']; $isPaid = !is_null($loginState['paiduntil']) && $loginState['paiduntil'] > time(); $period = intval($period, 10); $period = max(min($period, SUBSCRIPTION_WATCH_MAX_PERIOD), SUBSCRIPTION_WATCH_MIN_PERIOD); if (!$isPaid) { $period = max($period, SUBSCRIPTION_WATCH_MIN_PERIOD_FREE); } $db = DBConnect(); $stmt = $db->prepare('update tblUser set watchperiod = ? where id = ?'); $stmt->bind_param('ii', $period, $userId); $stmt->execute(); $stmt->close(); MCDelete(SUBSCRIPTION_REPORTS_CACHEKEY . $userId); return GetReports($loginState); }