function createGrid($tablename, $fields) { connectToDb(); if (isset($_POST['submitDelete'])) { deleteRecord($_POST['hfRecordID'], $tablename); } $queryFields = ''; $grid = '<table border="1"><tr>'; foreach ($fields as $index => $value) { if (end($fields) == $value) { $queryFields .= "{$index} "; } else { $queryFields .= "{$index}, "; } $grid .= "<td>{$value}</td>"; } $grid .= '<td>دستورات</td>'; $grid .= '</tr>'; $query = "SELECT {$queryFields} FROM {$tablename}"; $result = mysql_query($query); while ($radif = mysql_fetch_assoc($result)) { $grid .= '<tr>'; foreach ($radif as $value) { $grid .= "<td>{$value}</td>"; } $grid .= "\n <td>\n <form action='' method='post'>\n <input type='hidden' value='{$radif['id']}' name='hfRecordID' />\n <input onclick='return confirm(\"آیای از حذف رکورد مطمئنید?\")' type='submit' value='حذف' name='submitDelete'\n </form> \n </td>\n "; $grid .= '</tr>'; } $colspan = count($fields) + 1; $allRecordCount = mysql_num_rows($result); $grid .= "<tr><td colspan='{$colspan}'>تعداد کل ردیف ها : {$allRecordCount}</td></tr>"; $grid .= '</table>'; echo $grid; }
function _moduleContent(&$smarty, $module_name) { global $arrConf; //folder path for custom templates $local_templates_dir = getWebDirModule($module_name); //conexion resource $dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb'); $pDB = new paloDB($dsn); //user credentials global $arrCredentials; $action = getAction(); $content = ""; switch ($action) { case 'delete': $content = deleteRecord($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials); break; case 'download': $content = downloadFile($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials); break; case "display_record": $content = display_record($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials); break; default: $content = reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials); break; } return $content; }
<?php $root = '../'; require_once $root . 'logincheck.php'; require_once $root . 'functions.php'; $emp_section; // Delete algo for multi-selection deletion. if ($_SERVER['REQUEST_METHOD'] == 'POST') { foreach ($_POST as $key => $value) { if (strpos($key, 'emp_section_') !== false && $value == 'on') { $emp_section = deleteRecord('emp_section', 'emp_section_id', substr($key, 12)); } } // Change the message to confirm multiple deletion. if (count($_POST) > 2 && $emp_section) { $emp_section['message'] = 'Successfuly deleted all selected employee sections.'; } // Create a message for the deleted emp_section. $_SESSION['message'] = str_replace('Emp Section', 'Employee Section', $emp_section['message']); } // Reload the page header("Location: ./"); exit;
function modalidadeDelete($id) { deleteRecord('modalidades', "id_modalidade = " . dbInteger($id)); }
function deleteRecord($id, $needDeleteFile = true) { $id = intval($id); $res = mysql_query("SELECT rec_AddedByUGrpID, rec_OwnerUGrpID, rec_RecTypeID FROM Records WHERE rec_ID = " . $id); $row = mysql_fetch_assoc($res); $recTypeID = $row["rec_RecTypeID"]; $owner = $row["rec_OwnerUGrpID"]; if (!is_admin()) { if (!($owner == get_user_id() || is_admin('group', $owner))) { return array("error" => "user not authorised to delete record"); } } // find any references to the record if (false) { $res = mysql_query("SELECT DISTINCT dtl_RecID\n\t\t FROM defDetailTypes\n\t\t LEFT JOIN recDetails ON dtl_DetailTypeID = dty_ID\n\t\t WHERE dty_Type = 'resource'\n\t\t AND dtl_Value = " . $id); $reference_count = mysql_num_rows($res); if ($reference_count > 0) { return array("error" => "record cannot be deleted - there are existing references to it"); } } $bkmk_count = 0; $rels_count = 0; $error = null; // find any bookmarks of the record /* AO: what we should do with $bkmk_ids????? $reference_ids = array(); while ($row = mysql_fetch_assoc($res)) array_push($reference_ids, $row["dtl_RecID"]); $res = mysql_query("select bkm_ID from Records left join usrBookmarks on bkm_recID=rec_ID where rec_ID = " . $id . " and bkm_ID is not null"); $bkmk_count = mysql_num_rows($res); $bkmk_ids = array(); while ($row = mysql_fetch_assoc($res)) { array_push($bkmk_ids, $row["bkm_ID"]); } $res = mysql_query('select '.USERS_USERNAME_FIELD.' from Records left join usrBookmarks on bkm_recID=rec_ID left join '.USERS_DATABASE.'.'.USERS_TABLE.' on '.USERS_ID_FIELD.'=bkm_UGrpID where rec_ID = ' . $rec_id); $bkmk_count = mysql_num_rows($res); $bkmk_users = array(); while ($row = mysql_fetch_assoc($res)) array_push($bkmk_users, $row[USERS_USERNAME_FIELD]); ($bkmk_count == 0 || ($bkmk_count == 1 && $bkmk_users[0] == get_user_username())))) { */ while (true) { //delete uploaded files $fd_res = unregister_for_recid2($id, $needDeleteFile); if ($fd_res) { $error = "database error - " . $fd_res; break; } mysql_query('SET foreign_key_checks = 0'); // mysql_query('delete from recDetails where dtl_RecID = ' . $id); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } // mysql_query('delete from Records where rec_ID = ' . $id); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } $deleted = mysql_affected_rows(); deleteRecordIndexEntry(DATABASE, $recTypeID, $id); mysql_query('delete from usrReminders where rem_RecID = ' . $id); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } mysql_query('delete from usrRecTagLinks where rtl_RecID = ' . $id); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } mysql_query('delete from recThreadedComments where cmt_RecID = ' . $id); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } //change all woots with title bookmark: to user: mysql_query('update woots set woot_Title="user:"******"boomark:",bkm_ID) as title from usrBookmarks where bkm_recID = ' . $id . ')'); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } mysql_query('delete from usrBookmarks where bkm_recID = ' . $id); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } $bkmk_count = mysql_affected_rows(); //delete from woot mysql_query('delete from woot_ChunkPermissions where wprm_ChunkID in ' . '(SELECT chunk_ID FROM woots, woot_Chunks where chunk_WootID=woot_ID and woot_Title="record:' . $id . '")'); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } mysql_query('delete from woot_Chunks where chunk_WootID in ' . '(SELECT woot_ID FROM woots where woot_Title="record:' . $id . '")'); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } mysql_query('delete from woot_RecPermissions where wrprm_WootID in ' . '(SELECT woot_ID FROM woots where woot_Title="record:' . $id . '")'); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } mysql_query('delete from woots where woot_Title="record:' . $id . '"'); if (mysql_error()) { $error = "database error - " . mysql_error(); break; } mysql_query('SET foreign_key_checks = 1'); //remove special kind of record - relationship $refs_res = mysql_query('select rec_ID from recDetails left join defDetailTypes on dty_ID=dtl_DetailTypeID left join Records on rec_ID=dtl_RecID where dty_Type="resource" and dtl_Value=' . $id . ' and rec_RecTypeID=' . RT_RELATION); while ($row = mysql_fetch_assoc($refs_res)) { $res = deleteRecord($row['rec_ID']); if (array_key_exists("error", $res)) { $error = $res["error"]; break; } else { $rels_count += $res["bkmk_count"]; $bkmk_count += $res["rel_count"]; } } break; } if ($error == null) { return array("deleted" => $id, "bkmk_count" => $bkmk_count, "rel_count" => $rels_count); } else { return array("error" => $error); } }
// Lifetime added 5min. if (isset($_SESSION['EXPIRETIME'])) { if ($_SESSION['EXPIRETIME'] < time()) { unset($_SESSION['EXPIRETIME']); header('Location: logout.php?TIMEOUT'); exit(0); } else { // Session time out time 5min. //$_SESSION['EXPIRETIME'] = time() + 300; $_SESSION['EXPIRETIME'] = time() + $sessionTimeout; } } // Remove record. if ($_GET['delUserId']) { $delUserId = $_GET['delUserId']; deleteRecord($delUserId); } // Select departments lists. mysql_select_db($dbName) or die("Unable to select database: " . mysql_error()); $queryDept = "SELECT * from departments WHERE status = 'Active' ORDER BY deptName ASC"; $resultDept = mysql_query($queryDept); $rowDept = mysql_num_rows($resultDept); if (!$resultDept) { die("Table access failed: " . mysql_error()); } // Select position. $queryPosition = "SELECT * FROM position WHERE status = 'Active' ORDER BY positionName ASC"; $resultPosition = mysql_query($queryPosition); $rowPosition = mysql_num_rows($resultPosition); if (!$resultPosition) { die("Table access failed: " . mysql_error());
$partsId = mysql_escape_string($_GET['partsId']); // Lifetime added 5min. if (isset($_SESSION['EXPIRETIME'])) { if ($_SESSION['EXPIRETIME'] < time()) { unset($_SESSION['EXPIRETIME']); header('Location: logout.php?TIMEOUT'); exit(0); } else { // Session time out. $_SESSION['EXPIRETIME'] = time() + $sessionTimeout; } } // Remove record. if ($_GET['delPartsId']) { $delPartsId = $_GET['delPartsId']; deleteRecord($delPartsId); } // Select parts details. mysql_select_db($dbName) or die("Unable to select database: " . mysql_error()); $query = "SELECT * from partsMasterFile WHERE partsId = '{$partsId}' ORDER BY id DESC"; $result = mysql_query($query); $row = mysql_num_rows($result); if (!$result) { die("Table access failed: " . mysql_error()); } $data = mysql_fetch_assoc($result); $dateTimeFull = $data['dateTime']; if (preg_match('/(\\d{4}-\\d{2}-\\d{2})/', $dateTimeFull, $match)) { $dateTime = $match[1]; } $partsNumber = $data['partsNumber'];
} echo "{"; if ($_GET["action"] == "update") { connectDatabase("usagedata"); getData(); echo ", "; getMeta(); } else { if ($_GET["action"] == "headers") { connectDatabase("usagedata"); getHeaders(); } else { if ($_GET["action"] == "locations") { connectDatabase("usagedata"); getLocations(); } else { if ($_GET["action"] == "delete") { connectDatabase("usagedata"); deleteRecord(); } else { connectDatabase("usagedata"); getHeaders(); echo ", "; getData(); echo ", "; getMeta(); } } } } echo "}";
function visitanteDelete($id) { deleteRecord("visitantes", "id_visitante = " . dbInteger($id)); }
function DeleteJSONRecord($table) { if (!sesWriteAccess()) { header('HTTP/1.1 403 Forbidden'); exit; } $id = getRequest('id', ''); if ($id) { deleteRecord("{prefix}{$table}", $id); header('Content-Type: application/json'); echo json_encode(['status' => 'ok']); } }
<tr> <td></td> <td> <INPUT type="submit" name="button" value="Enter" style="padding:4px" /></td> </tr> </table> </form> </legend></fieldset> <?php $today = date('Y-m-d'); if ($_GET['submitted']) { $genericInsert = "INSERT INTO deposit(trans_id,source,amount,discription,date,entryDate) " . "VALUES('','{$_POST['type']}','{$_POST['amount']}','{$_POST['description']}','{$_POST['date']}','{$today}');"; $depositResult = mysql_query($genericInsert); if ($depositResult != null) { echo '<p>Data entered successfully</p>'; } else { echo '<p>Failed to enter data</p>'; } displayToday('deposit'); } if ($_GET['func'] == 'delete') { $id = $_GET['ref']; $deleted = deleteRecord($id, 'deposit'); if ($deleted) { echo '<p>Item deleted successfully.</p>'; } displayToday('deposit'); }
echo "document.getElementById('percent').innerHTML = Math.round(1000 * processed / " . $total_cnt . " ) / 10;"; ?> } </script> <?php print '<div><span id=total_count>' . $total_cnt . '</span> records in total to be deleted</div>'; print '<div><span id=processed_count>0</span> processed so far <span id=percent>0</span>%</div>'; print '<div><span id=deleted>0</span> deleted</div>'; print '<div><span id=relations>0</span> relationships</div>'; print '<div><span id=bookmarks>0</span> associated bookmarks</div>'; print '<div><span id=errors>0</span> errors</div>'; $needDeleteFile = @$_REQUEST['delfile'] == "1"; if ($total_cnt > 0) { foreach ($_REQUEST['bib'] as $rec_id) { mysql_query("start transaction"); $res = deleteRecord($rec_id, $needDeleteFile); //$res = array("bkmk_count"=>0, "rel_count"=>0); if (array_key_exists("error", $res)) { mysql_query("rollback"); array_push($errors, "Rec#" . $rec_id . " " . $res["error"]); } else { mysql_query("commit"); $recs_count++; $bkmk_count += $res["bkmk_count"]; $rels_count += $res["rel_count"]; } $processed_count++; if ($rec_id % 10 == 0) { print '<script type="text/javascript">update_counts(' . $processed_count . ',' . $recs_count . ',' . $rels_count . ',' . $bkmk_count . ',' . count($errors) . ')</script>' . "\n"; @ob_flush(); @flush();
/** * deleteRectype - Helper function that delete a rectype from defRecTypes table.if there are no existing records of this type * * @author Stephen White * @param $rtyID rectype ID to delete * @return $ret an array of return values for the various data elements created or errors if they occurred **/ function deleteRecType($rtyID) { global $mysqli; $ret = array(); $query = "select rec_ID from Records where rec_RecTypeID={$rtyID} and rec_FlagTemporary=0 limit 1"; $res = $mysqli->query($query); $error = $mysqli->error; if ($error) { $ret['error'] = "SQL error finding records of type {$rtyID} in the Records table: " . $error; } else { $recCount = $res->num_rows; if ($recCount) { // there are records existing of this rectype, need to return error and the recIDs $ret['error'] = "You cannot delete record type {$rtyID} as it has existing data records"; //$recCount $ret['recIDs'] = array(); while ($row = $res->fetch_row()) { array_push($ret['recIDs'], $row[0]); } } else { // no records ok to delete this rectype. Not that this should cascade for all dependent definitions //delete temporary records $query = "select rec_ID from Records where rec_RecTypeID={$rtyID} and rec_FlagTemporary=1"; $res = $mysqli->query($query); while ($row = $res->fetch_row()) { deleteRecord($row[0]); } $query = "delete from defRecTypes where rty_ID = {$rtyID}"; $res = $mysqli->query($query); if ($mysqli->error) { $ret['error'] = "SQL error deleting record type {$rtyID} from defRecTypes table: " . $mysqli->error; } else { $icon_filename = HEURIST_ICON_DIR . $rtyID . ".png"; //BUG what about thumb?? if (file_exists($icon_filename)) { unlink($icon_filename); } $ret['result'] = $rtyID; } } } return $ret; }
show404(); } $crud_page = getCrudPage($_GET['page_id']); if (!$crud_page) { show404(); } pr($crud_page); // default values $recordTitle = singularize($crud_page['title'], 0, -1); // e.g. Employee, Pay Record etc $url = $crud_page['url'] . "?page_id=" . $_GET['page_id']; // $url = isset( $_SERVER['HTTP_REFERER'] )? $_SERVER['HTTP_REFERER'] : $crud_page['url']."?page_id=".$crud_page['id']; // check deleting: if (isset($_GET['record_id']) && isset($_GET['delete']) && $_GET['delete'] == 'true') { $logmsg = $recordTitle . " Deleted: Record Id = " . $_GET['record_id']; deleteRecord($crud_page['table_name'], "id=" . $_GET['record_id'], $logmsg, $url); } // handle posted data if (isset($_POST['submit'])) { // prpost(); validatefft($crud_page['table_name']); if ($form->isValid()) { $condition = isset($_GET['record_id']) ? "id=" . $_GET['record_id'] : NULL; $logmsg = isset($_GET['record_id']) ? $recordTitle . " Edited: " . $recordTitle . " ID: " . $_POST['id'] : "New " . $recordTitle . " Saved"; saveFormData($crud_page['table_name'], $_POST, $condition, $logmsg, $url); } } ?> <h2><?php echo $recordTitle;
header('Location: logout.php?TIMEOUT'); exit(0); } else { /** Session time out time 5min. **/ //$_SESSION['EXPIRETIME'] = time() + 300; $_SESSION['EXPIRETIME'] = time() + $sessionTimeout; } } /** Remove record. **/ if ($_GET['delStatusId']) { $delStatusId = $_GET['delStatusId']; deleteRecord($delStatusId); } /** Select status lists. **/ mysql_select_db($dbName) or die("Unable to select database: " . mysql_error()); $query = "SELECT * FROM status WHERE statusId = '{$statusId}'"; $result = mysql_query($query); if (!$result) { die("Table access failed: " . mysql_error()); } $data = mysql_fetch_array($result); $statusName = $data['statusName']; if (isset($_POST['statusId']) && isset($_POST['statusName'])) { $statusId = $_POST['statusId']; $statusName = ucwords(mysql_escape_string($_POST['statusName']));
header('Location: logout.php?TIMEOUT'); exit(0); } else { /** Session time out time 5min. **/ //$_SESSION['EXPIRETIME'] = time() + 300; $_SESSION['EXPIRETIME'] = time() + $sessionTimeout; } } /** Remove record. **/ if ($_GET['delUnitId']) { $delUnitId = $_GET['delUnitId']; deleteRecord($delUnitId); } /** Select unit lists. **/ mysql_select_db($dbName) or die("Unable to select database: " . mysql_error()); $query = "SELECT * FROM unit WHERE unitId = '{$unitId}'"; $result = mysql_query($query); if (!$result) { die("Table access failed: " . mysql_error()); } $data = mysql_fetch_array($result); $unitName = $data['unitName']; if (isset($_POST['unitId']) && isset($_POST['unitName'])) { $unitId = $_POST['unitId']; $unitName = ucwords(mysql_escape_string($_POST['unitName']));
print mysql_affected_rows() . " DELETED\n \n"; } else { if (preg_match("/^insert/i", $x)) { print mysql_affected_rows() . " INSERTED\n \n"; } } } } return $res; } require_once dirname(__FILE__) . "/../../common/connect/applyCredentials.php"; require_once dirname(__FILE__) . "/../../common/php/dbMySqlWrappers.php"; require_once dirname(__FILE__) . "/../../records/edit/deleteRecordInfo.php"; if (!is_logged_in()) { jsonError("no logged-in user"); } $_REQUEST = json_decode(@$_POST["data"] ? $_POST["data"] : base64_decode(@$_GET["data"]), true); mysql_connection_overwrite(DATABASE); mysql_query("start transaction"); $out = deleteRecord(@$_REQUEST["id"]); if (array_key_exists("error", $out)) { jsonError($out["error"]); } mysql_query("commit"); print json_format($out); function jsonError($message) { mysql_query("rollback"); print "{\"error\":\"" . addslashes($message) . "\"}"; exit(0); }
// Lifetime added 5min. if (isset($_SESSION['EXPIRETIME'])) { if ($_SESSION['EXPIRETIME'] < time()) { unset($_SESSION['EXPIRETIME']); header('Location: logout.php?TIMEOUT'); exit(0); } else { // Session time out time 5min. //$_SESSION['EXPIRETIME'] = time() + 300; $_SESSION['EXPIRETIME'] = time() + $sessionTimeout; } } // Remove record. if ($_GET['delEquipTypeId']) { $delId = $_GET['delEquipTypeId']; deleteRecord($delId, 'partsEquipType', 'partsEquipTypeId'); } // Select parts uom. mysql_select_db($dbName) or die("Unable to select database: " . mysql_error()); $query = "SELECT * FROM partsEquipType WHERE partsEquipTypeId = '{$partsEquipTypeId}'"; $result = mysql_query($query); if (!$result) { die("Table access failed: " . mysql_error()); } $data = mysql_fetch_array($result); $partsEquipTypeName = $data['partsEquipTypeName']; if (isset($_POST['partsEquipTypeId']) && isset($_POST['partsEquipTypeName'])) { $partsEquipTypeId = $_POST['partsEquipTypeId']; $partsEquipTypeName = ucwords(strtolower(mysql_escape_string($_POST['partsEquipTypeName']))); $query = "SELECT DATE_ADD(NOW(), INTERVAL 13 HOUR) AS 'dateTime'"; $result = mysql_query($query);
<td></td> <td> <INPUT type="submit" name="button" value="Enter" style="padding:4px" /></td> </tr> </table> </form> </legend></fieldset> <?php $today = date('Y-m-d'); if ($_GET['submitted']) { $genericInsert = "INSERT INTO withdrawals(trans_id,source,amount,description,date,entryDate) " . "VALUES('','{$_POST['type']}','{$_POST['amount']}','{$_POST['description']}','{$_POST['date']}','{$today}');"; $withdrawResult = mysql_query($genericInsert); if ($withdrawResult != null) { echo '<p>Data entered successfully</p>'; } else { echo '<p>Failed to enter data</p>'; } displayToday('withdraw'); } if ($_GET['func'] == 'delete') { $id = $_GET['ref']; $deleted = deleteRecord($id, 'withdraw'); if ($deleted) { echo '<p>Item deleted successfully.</p>'; } displayToday('withdraw'); }
/** * put your comment there... * * @param mixed $recID - group id to be deleted */ function deleteGroup($recID) { global $db; $ret = array(); $ret2 = checkPermission('group', $recID); if ($ret2 != null) { $ret['error'] = $ret2; return $ret; } $query = "select rec_ID from Records where rec_OwnerUGrpID={$recID} and rec_FlagTemporary=0 limit 1"; $rows = execSQL($db, $query, null, true); if (is_string($rows)) { $ret['error'] = "error finding Records for User {$recID} in deleteGroup - " . $rows; } else { if ($rows > 0) { $ret['error'] = "Error. Deleting Group ({$recID}) with existing Records not allowed"; } else { // no Records belong this User - ok to delete this User. /* $query = "select ugl_UserID from sysUsrGrpLinks where ugl_GroupID=$recID limit 1"; $rows = execSQL($db, $query, null, true); if (!is_numeric($rows)) { $ret['error'] = "error finding Users for Group $recID in deleteGroup - ".$rows; }else if ($rows>0){ $ret['error'] = "Error. Deleting Group ($recID) with existing Users not allowed"; }else{ }*/ //delete temporary records $query = "select rec_ID from Records where rec_OwnerUGrpID={$recID} and rec_FlagTemporary=1"; $res = mysql_query($query); while ($row = mysql_fetch_row($res)) { deleteRecord($row[0]); } $query = "delete from sysUsrGrpLinks where ugl_GroupID={$recID}"; $rows = execSQL($db, $query, null, true); if ($rows == 0 || is_string($rows)) { $ret['error'] = "db error deleting relations for Group {$recID} from sysUsrGrpLinks - " . $rows; } else { $query = "delete from sysUGrps where ugr_ID={$recID}"; $rows = execSQL($db, $query, null, true); if ($rows == 0 || is_string($rows)) { $ret['error'] = "db error deleting of Group {$recID} from sysUGrps - " . $rows; } else { $ret['result'] = $recID; $groups = reloadUserGroups(get_user_id()); updateSessionForUser(get_user_id(), 'user_access', $groups); } } } } return $ret; }
<?php require "login/login.php"; include 'monitor.inc'; include 'db_utils.inc'; $id = $_REQUEST['id']; displayErrorIfNotAdmin(); deleteRecord("wptjob_wptlocation", "wptlocationid", $id); deleteRecord("WPTLocation", "Id", $id); header("Location: listLocations.php");
function deleteTest($index) { $delTestId = numDecrypt($index); if (deleteRecord('test_info', 'test_id', $delTestId)) { $sqlRun = mysql_query("UPDATE users SET tests_taken= tests_taken-1 WHERE id = '{$_SESSION['user_id']}'"); if ($sqlRun) { return true; } } }
<?php include 'db.php'; if ($_SESSION['username'] != "ttt") { header("Location: index.php"); } if (isset($_GET['delete']) && isset($_GET['type'])) { deleteRecord($_GET['type'], $_GET['delete']); header("Location: ../cmsRemove.php"); } function getUsers() { $array_users = getAllUsers(); foreach ($array_users as $user) { $username = $user["username"]; $email = $user["email"]; $join = $user["join_date"]; echo "<tr><td>{$username}</td><td>{$email}</td><td>{$join}</td><td><a href='App_Code/cmsView.php?type=user&delete={$username}'>DELETE</a></td></tr>"; } } function listSongs() { $array_songs = getAllSongs(); foreach ($array_songs as $song) { $id = $song["id"]; $songName = $song["artist"] . ' - ' . $song["title"]; $likes = $song["likes"]; echo "<tr><td>{$id}</td><td>{$songName}</td><td>{$likes}</td><td><a href='App_Code/cmsView.php?type=song&delete={$id}'>DELETE</a></td></tr>"; } } function getComment($type)
if (isset($_GET['id'])) { deleteRecord($_GET['id']); } function deleteRecord($idValue) { $sql = "technologyDelete"; $sqlValues = $idValue; GlobalCrud::delete($sql, $sqlValues); } if (isset($_GET['id'])) { deleteRecord($_GET['id']); } /* function deleteRecord($idValue) { $sql = "traineeDelete"; $sqlValues = $idValue; GlobalCrud::delete($sql,$sqlValues); } if (isset($_GET['id'])) { deleteRecord($_GET['id']); } */ function deleteRecord($idValue) { $sql = "batchDelete"; $sqlValues = $idValue; GlobalCrud::delete($sql, $sqlValues); } if (isset($_GET['id'])) { deleteRecord($_GET['id']); }
function createForm($strFunc, $strList, $strForm) { require "form_switch.php"; if (!sesAccessLevel($levelsAllowed) && !sesAdminAccess()) { ?> <div class="form_container ui-widget-content"> <?php echo $GLOBALS['locNoAccess'] . "\n"; ?> </div> <?php return; } $blnNew = getPostRequest('newact', FALSE); $blnCopy = getPostRequest('copyact', FALSE) ? TRUE : FALSE; $blnDelete = getPostRequest('deleteact', FALSE) ? TRUE : FALSE; $intKeyValue = getPostRequest('id', FALSE); if (!$intKeyValue) { $blnNew = TRUE; } if (!sesWriteAccess() && ($blnNew || $blnCopy || $blnDelete)) { ?> <div class="form_container ui-widget-content"> <?php echo $GLOBALS['locNoAccess'] . "\n"; ?> </div> <?php return; } $strMessage = ''; if (isset($_SESSION['formMessage']) && $_SESSION['formMessage']) { $strMessage = $GLOBALS['loc' . $_SESSION['formMessage']]; unset($_SESSION['formMessage']); } $strErrorMessage = ''; if (isset($_SESSION['formErrorMessage']) && $_SESSION['formErrorMessage']) { $strErrorMessage = $GLOBALS['loc' . $_SESSION['formErrorMessage']]; unset($_SESSION['formErrorMessage']); } // if NEW is clicked clear existing form data if ($blnNew) { unset($intKeyValue); unset($astrValues); unset($_POST); unset($_REQUEST); $readOnlyForm = false; } $astrValues = getPostValues($astrFormElements, isset($intKeyValue) ? $intKeyValue : FALSE); $redirect = getRequest('redirect', null); if (isset($redirect)) { // Redirect after save foreach ($astrFormElements as $elem) { if ($elem['name'] == $redirect) { if ($elem['style'] == 'redirect') { $newLocation = str_replace('_ID_', $intKeyValue, $elem['listquery']); } elseif ($elem['style'] == 'openwindow') { $openWindow = str_replace('_ID_', $intKeyValue, $elem['listquery']); } } } } if ($blnDelete && $intKeyValue && !$readOnlyForm) { deleteRecord($strTable, $intKeyValue); unset($intKeyValue); unset($astrValues); $blnNew = TRUE; if (getSetting('auto_close_after_delete')) { $qs = preg_replace('/&form=\\w*/', '', $_SERVER['QUERY_STRING']); $qs = preg_replace('/&id=\\w*/', '', $qs); header("Location: " . _PROTOCOL_ . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php?{$qs}"); return; } ?> <div class="form_container ui-widget-content"> <?php echo $GLOBALS['locRecordDeleted'] . "\n"; ?> </div> <?php return; } if (isset($intKeyValue) && $intKeyValue) { $res = fetchRecord($strTable, $intKeyValue, $astrFormElements, $astrValues); if ($res === 'deleted') { $strMessage .= $GLOBALS['locDeletedRecord'] . '<br>'; } elseif ($res === 'notfound') { echo $GLOBALS['locEntryDeleted']; die; } } if ($blnCopy) { unset($intKeyValue); unset($_POST); $blnNew = TRUE; $readOnlyForm = false; } ?> <div id="popup_dlg" style="display: none; width: 900px; overflow: hidden"> <iframe id="popup_dlg_iframe" src="about:blank" style="width: 100%; height: 100%; overflow: hidden; border: 0"></iframe> </div> <?php if (isset($popupHTML)) { echo $popupHTML; } ?> <div class="form_container"> <?php createFormButtons($blnNew, $copyLinkOverride, true, $readOnlyForm); ?> <div class="form"> <form method="post" name="admin_form" id="admin_form"> <input type="hidden" name="copyact" value="0"> <input type="hidden" name="newact" value="<?php echo $blnNew ? 1 : 0; ?> "> <input type="hidden" name="deleteact" value="0"> <input type="hidden" name="redirect" id="redirect" value=""> <input type="hidden" id="record_id" name="id" value="<?php echo isset($intKeyValue) && $intKeyValue ? $intKeyValue : ''; ?> "> <table> <?php $haveChildForm = false; $prevPosition = false; $prevColSpan = 1; $rowOpen = false; $formFieldMode = sesWriteAccess() && !$readOnlyForm ? 'MODIFY' : 'READONLY'; foreach ($astrFormElements as $elem) { if ($elem['type'] === false) { continue; } $fieldMode = isset($elem['read_only']) && $elem['read_only'] ? 'READONLY' : $formFieldMode; if ($elem['type'] == "LABEL") { if ($rowOpen) { echo " </tr>\n"; } $rowOpen = false; ?> <tr> <td class="sublabel ui-widget-header ui-state-default" colspan="4"> <?php echo $elem['label']; ?> </td> </tr> <?php continue; } if ($elem['position'] == 0 || $elem['position'] <= $prevPosition) { $prevPosition = 0; $prevColSpan = 1; echo " </tr>\n"; $rowOpen = false; } if ($elem['type'] != "IFORM") { if (!$rowOpen) { $rowOpen = true; echo " <tr>\n"; } if ($prevPosition !== FALSE && $elem['position'] > 0) { for ($i = $prevPosition + $prevColSpan; $i < $elem['position']; $i++) { echo " <td class=\"label\"> </td>\n"; } } if ($elem['position'] == 0 && !strstr($elem['type'], "HID_")) { $strColspan = "colspan=\"3\""; $intColspan = 3; } elseif ($elem['position'] == 1 && !strstr($elem['type'], "HID_")) { $strColspan = ''; $intColspan = 2; } else { $intColspan = 2; } } if ($blnNew && ($elem['type'] == 'BUTTON' || $elem['type'] == 'JSBUTTON' || $elem['type'] == 'IMAGE')) { echo " <td class=\"label\"> </td>"; } elseif ($elem['type'] == "BUTTON" || $elem['type'] == "JSBUTTON") { $intColspan = 1; ?> <td class="button"> <?php echo htmlFormElement($elem['name'], $elem['type'], $astrValues[$elem['name']], $elem['style'], $elem['listquery'], $fieldMode, $elem['parent_key'], $elem['label'], array(), isset($elem['elem_attributes']) ? $elem['elem_attributes'] : '', isset($elem['options']) ? $elem['options'] : null); ?> </td> <?php } elseif ($elem['type'] == "FILLER") { $intColspan = 1; ?> <td> </td> <?php } elseif ($elem['type'] == "HID_INT" || strstr($elem['type'], "HID_")) { ?> <?php echo htmlFormElement($elem['name'], $elem['type'], $astrValues[$elem['name']], $elem['style'], $elem['listquery'], $fieldMode, $elem['parent_key'], $elem['label']); } elseif ($elem['type'] == "IMAGE") { ?> <td class="image" colspan="<?php echo $intColspan; ?> "> <?php echo htmlFormElement($elem['name'], $elem['type'], $astrValues[$elem['name']], $elem['style'], $elem['listquery'], $fieldMode, $elem['parent_key'], $elem['label'], array(), isset($elem['elem_attributes']) ? $elem['elem_attributes'] : '', isset($elem['options']) ? $elem['options'] : null); ?> </td> <?php } elseif ($elem['type'] == "IFORM") { if ($rowOpen) { echo " </tr>\n"; } echo " </table>\n </form>\n"; $haveChildForm = true; createIForm($astrFormElements, $elem, isset($intKeyValue) ? $intKeyValue : 0, $blnNew, $strForm); break; } else { $value = $astrValues[$elem['name']]; if ($elem['style'] == 'measurement') { $value = $value ? miscRound2Decim($value, 2) : ''; } if ($elem['type'] == 'AREA') { ?> <td class="toplabel"><?php echo $elem['label']; ?> </td> <?php } else { ?> <td id="<?php echo htmlentities($elem['name']) . '_label'; ?> " class="label"<?php if (isset($elem['title'])) { echo ' title="' . $elem['title'] . '"'; } ?> ><?php echo $elem['label']; ?> </td> <?php } ?> <td class="field"<?php echo $strColspan ? " {$strColspan}" : ''; ?> > <?php echo htmlFormElement($elem['name'], $elem['type'], $value, $elem['style'], $elem['listquery'], $fieldMode, isset($elem['parent_key']) ? $elem['parent_key'] : '', '', array(), isset($elem['elem_attributes']) ? $elem['elem_attributes'] : '', isset($elem['options']) ? $elem['options'] : null); if (isset($elem['attached_elem'])) { echo ' ' . $elem['attached_elem'] . "\n"; } ?> </td> <?php } $prevPosition = is_int($elem['position']) ? $elem['position'] : 0; if ($prevPosition == 0) { $prevPosition = 255; } $prevColSpan = $intColspan; } if (!$haveChildForm) { if ($rowOpen) { echo " </tr>\n"; } echo " </table>\n </form>\n"; } if ($strForm == 'product') { // Special case for product: show stock balance change log ?> <div class="iform ui-corner-tl ui-corner-bl ui-corner-br ui-corner-tr ui-helper-clearfix" id="stock_balance_log"> <div class="ui-corner-tl ui-corner-tr fg-toolbar ui-toolbar ui-widget-header"><?php echo $GLOBALS['locStockBalanceUpdates']; ?> </div> <table id="stock_balance_change_log"> <tr> <th class="medium"><?php echo $GLOBALS['locHeaderChangeLogDateTime']; ?> </th> <th class="medium"><?php echo $GLOBALS['locHeaderChangeLogUser']; ?> </th> <th class="small"><?php echo $GLOBALS['locHeaderChangeLogAmount']; ?> </th> <th class="long"><?php echo $GLOBALS['locHeaderChangeLogDescription']; ?> </th> </tr> </table> </div> </div> <?php } ?> </div> <script type="text/javascript"> /* <![CDATA[ */ var globals = {}; $(window).bind('beforeunload', function(e) { if ($('.save_button').hasClass('ui-state-highlight') || $('.add_row_button').hasClass('ui-state-highlight')) { e.returnValue = "<?php echo $GLOBALS['locUnsavedData']; ?> "; return "<?php echo $GLOBALS['locUnsavedData']; ?> "; } }); function showmsg(msg, timeout) { $.floatingMessage("<span>" + msg + "</span>", { position: "top-right", className: "ui-widget ui-state-highlight", show: "show", hide: "fade", stuffEaseTime: 200, moveEaseTime: 0, time: typeof(timeout) != 'undefined' ? timeout : 5000 }); } function errormsg(msg, timeout) { $.floatingMessage("<span>" + msg + "</span>", { position: "top-right", className: "ui-widget ui-state-error", show: "show", hide: "fade", stuffEaseTime: 200, moveEaseTime: 0, time: typeof(timeout) != 'undefined' ? timeout : 5000 }); } $(document).ready(function() { <?php if ($strMessage) { ?> showmsg("<?php echo $strMessage; ?> "); <?php } if ($strErrorMessage) { ?> errormsg("<?php echo $strErrorMessage; ?> "); <?php } if ($strForm == 'product') { ?> update_stock_balance_log(); <?php } if (sesWriteAccess()) { ?> $('input[class~="hasCalendar"]').datepicker(); <?php } ?> $('#message').ajaxStart(function() { $('#spinner').css('visibility', 'visible'); }); $('#message').ajaxStop(function() { $('#spinner').css('visibility', 'hidden'); }); $('#errormsg').ajaxError(function(event, request, settings) { errormsg('Server request failed: ' + request.status + ' - ' + request.statusText); $('#spinner').css('visibility', 'hidden'); }); $('#admin_form').find('input[type="text"],input[type="hidden"],input[type="checkbox"],select,textarea').change(function() { $('.save_button').addClass('ui-state-highlight'); }); <?php if ($haveChildForm && !$blnNew) { ?> init_rows(); $('#iform').find('input[type="text"],input[type="hidden"],input[type="checkbox"],select,textarea').change(function() { $('.add_row_button').addClass('ui-state-highlight'); }); <?php } elseif (isset($newLocation)) { echo "window.location='{$newLocation}';"; } if (isset($openWindow)) { echo "window.open('{$openWindow}');"; } ?> }); <?php if ($haveChildForm && !$blnNew) { ?> function init_rows_done() { <?php if (isset($newLocation)) { echo "window.location='{$newLocation}';"; } ?> } <?php } ?> function save_record(redirect_url, redir_style) { var form = document.getElementById('admin_form'); var obj = new Object(); <?php foreach ($astrFormElements as $elem) { if ($elem['name'] && !in_array($elem['type'], array('HID_INT', 'SECHID_INT', 'BUTTON', 'JSBUTTON', 'LABEL', 'IMAGE', 'NEWLINE', 'ROWSUM', 'CHECK', 'IFORM'))) { ?> obj.<?php echo $elem['name']; ?> = form.<?php echo $elem['name']; ?> .value; <?php } elseif ($elem['type'] == 'CHECK') { ?> obj.<?php echo $elem['name']; ?> = form.<?php echo $elem['name']; ?> .checked ? 1 : 0; <?php } } ?> obj.id = form.id.value; $.ajax({ 'url': "json.php?func=put_<?php echo $strJSONType; ?> ", 'type': 'POST', 'dataType': 'json', 'data': $.toJSON(obj), 'contentType': 'application/json; charset=utf-8', 'success': function(data) { if (data.warnings) alert(data.warnings); if (data.missing_fields) { errormsg('<?php echo $GLOBALS['locErrValueMissing']; ?> : ' + data.missing_fields); } else { $('.save_button').removeClass('ui-state-highlight'); showmsg('<?php echo $GLOBALS['locRecordSaved']; ?> ', 2000); if (redirect_url) { if (redir_style == 'openwindow') window.open(redirect_url); else window.location = redirect_url; } if (!obj.id) { obj.id = data.id; form.id.value = obj.id; if (!redirect_url || redir_style == 'openwindow') { var newloc = new String(window.location).split('#', 1)[0]; window.location = newloc + '&id=' + obj.id; } } } }, 'error': function(XMLHTTPReq, textStatus, errorThrown) { if (XMLHTTPReq.status == 409) { errormsg(jQuery.parseJSON(XMLHTTPReq.responseText).warnings); } else if (textStatus == 'timeout') errormsg('Timeout trying to save data'); else errormsg('Error trying to save data: ' + XMLHTTPReq.status + ' - ' + XMLHTTPReq.statusText); return false; } }); } function popup_dialog(url, on_close, dialog_title, event, width, height) { $("#popup_dlg").dialog({ modal: true, width: width, height: height, resizable: true, position: [50, 50], buttons: { "<?php echo $GLOBALS['locClose']; ?> ": function() { $("#popup_dlg").dialog('close'); } }, title: dialog_title, close: function(event, ui) { eval(on_close); } }).find("#popup_dlg_iframe").attr("src", url); return true; } /* ]]> */ </script> <?php createFormButtons($blnNew, $copyLinkOverride, false, $readOnlyForm); echo " </div>\n"; if ($addressAutocomplete && getSetting('address_autocomplete')) { ?> <script type="text/javascript"> $(document).ready(function() { var s = document.createElement("script"); s.type = "text/javascript"; s.src = "https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places&callback=gmapsready"; window.gmapsready = function(){ initAddressAutocomplete(""); initAddressAutocomplete("quick_"); }; $("head").append(s); }); </script> <?php } }
* @Last Modified by: Alexander * @Last Modified time: 2016-03-17 21:06:32 */ $root = '../'; require_once $root . 'logincheck.php'; require_once $root . 'functions.php'; $work_status; // Delete algo for multi-selection deletion. if ($_SERVER['REQUEST_METHOD'] == 'POST') { foreach ($_POST as $key => $value) { if (strpos($key, 'work_status_') !== false && $value == 'on') { $work_status = deleteRecord('work_status', 'work_status_id', substr($key, 8)); } } if (count($_POST) > 2 && $work_status) { $work_status['message'] = 'Successfuly deleted all selected factories.'; } // Create a message for the deleted work_status. $_SESSION['message'] = $work_status['message']; } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { if (isset($_GET['work_status_id'])) { $work_status = deleteRecord('work_status', 'work_status_id', $_GET['work_status_id']); } // Create a message for the deleted work_status. $_SESSION['message'] = $work_status['message']; } } // Reload the page header("Location: ./"); exit;
<div class="TabbedPanelsContent"><?php displayToday('expences', $date); ?> </div> <div class="TabbedPanelsContent"><?php displayToday('sinna', $date); ?> </div> </div> </div> <?php } if ($_GET['func'] == 'delSinna') { $id = $_GET['ref']; $date = $_GET['date']; $deleted = deleteRecord($id, 'sinna'); if ($deleted) { echo '<p>Item deleted successfully.</p>'; } ?> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0">Pawning</li> <li class="TabbedPanelsTab" tabindex="0">Redeem</li> <li class="TabbedPanelsTab" tabindex="0">Expenses</li> <li class="TabbedPanelsTab" tabindex="0">Sinna</li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"><?php displayToday('pawning', $date); ?>
/*****************************************************************************/ } else { // Process the form echo '<p>Deletion in progress...</p>'; echo '<ul><pre>'; $records_to_delete = preg_split("/[\\s]+/", $_POST["records_to_delete_textarea"], -1, PREG_SPLIT_NO_EMPTY); $proj_id = $_GET["pid"]; $ndel = 0; for ($i = 0; $i < count($records_to_delete); $i++) { $rec_id = $records_to_delete[$i]; if ($verify_existence and ($nkvpairs = mgGetNumberOfKeyValuePairsForRecord($proj_id, $rec_id)) == 0) { printf("%s:\t%s\n", htmlspecialchars($rec_id), "DID NOT EXIST"); deleteRecord($rec_id); // But try again, anyway. } else { deleteRecord($rec_id); if (!$verify_deletion) { $ndel++; // Hope it worked (and it probably did)... printf("%s\n", htmlspecialchars($rec_id)); } elseif (($nkvpairs = mgGetNumberOfKeyValuePairsForRecord($proj_id, $rec_id)) == 0) { $ndel++; printf("%s:\t%s\n", htmlspecialchars($rec_id), "deleted"); } elseif ($nkvpairs > 0) { printf("%s:\t%s (%s)\n", htmlspecialchars($rec_id), "FAILED", $nkvpairs); } else { printf("%s:\t%s\n", htmlspecialchars($rec_id), "ERROR"); } } } echo '</pre></ul>';
function equipaDelete($id) { deleteRecord('equipas', "id_equipa = " . dbInteger($id)); }
} foreach ($_REQUEST as $key => $val) { if ($val == "New") { if (isset($prevTable) && is_array($prevTable)) { array_push($prevTable, $table); } else { $prevTable = array($table); } $table = $key; } } if ($deleteId != 0) { if ($numPendingTables > 0) { $msg .= " Refusing to process delete- there are pending tables."; } else { list($success, $m) = deleteRecord($db, $table, $deleteId); if (strlen($msg > 0)) { $msg .= " / " . $m; } else { $msg = $m; } // We do a redirect so that the 'deleteId' won't remain in the url. // *** RFD: There's got to be a better way! header("Location: " . $_SERVER["PHP_SELF"] . "?table=" . $table . "&msg=" . urlencode($msg)); exit; } } if (isset($_REQUEST["updateId"])) { $d[$table]['id'] = $_REQUEST["updateId"]; } else { $d[$table]['id'] = 0;