function provaUpdateStatus($id, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('provas', $fields, 'id_prova = ' . dbInteger($id)); if ($status == 'X') { $fields = array(); $fields['status'] = dbString('X'); updateRecord('provas_classificacoes', $fields, 'id_prova = ' . dbInteger($id)); } }
function equipaUpdateStatus($id, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('equipas', $fields, 'id_equipa = ' . dbInteger($id)); if ($status == 'X') { $fields = array(); $fields['status'] = dbString('X'); updateRecord('elementos_equipas', $fields, 'id_equipa = ' . dbInteger($id)); } }
function delegacaoUpdateStatus($id, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('delegacoes', $fields, 'id_delegacao = ' . dbInteger($id)); }
$acc = $am->getAccountById($ID); //delete all transactions in this account $acc->deleteAllTransactions(); //delete account $am->deleteAccount($ID); //delete entry in navigation deleteFromNavi($us->getProperty("accountNaviId_{$ID}")); } } else { echo "no ID was transmitted!"; } break; case 'save': //add record, update record if (isset($_POST['hiddenID'])) { updateRecord(); } else { header("Location: {$redirectPageAfterSave}"); } break; case 'new': case 'edit': //frontend form for edit or insert printFrontend(); break; } } require_once BADGER_ROOT . "/includes/fileFooter.php"; function printFrontend() { global $pageTitle;
function encomendasUpdate($fields) { $where = "pp_enc_id = " . dbString($fields['pp_enc_id']); unset($fields['pp_enc_id']); updateRecord("pp_encomendas", $fields, $where); }
print "<td>" . textwrap($record['team']) . "</td>"; print "<td>" . textwrap($record['name']) . "</td>"; print "<td>" . textwrap($record['place']) . "</td>"; print "<td>" . textwrap($record['place_detail']) . "</td>"; print "<td>" . textwrap($record['stored_date']) . "</td>"; $class = $record['checked'] == 1 ? "checked" : "notchecked"; print "<td class=" . $class . ">" . textwrap($record['date']) . "</td>"; print "<td class=" . $class . ">" . textwrap($record['check_person']) . "</td>"; //print("<td class=".$class.">".textwrap($record['checked'])."</td>"); print "</tr>\n"; } print "</table>\n"; $db->close(); } if (isset($iv_number) and isset($iv_checked) and isset($iv_user)) { updateRecord($iv_number, $iv_checked, $iv_user); header("Location: " . $_SERVER['PHP_SELF']); exit; } ?> </head> <body> <h1>Welcome to Iventory Server</h1> <div class="getapp"> <a class="getapp" href="./qrreader.apk">Get Android App!</a> </div> <div> <form action="./index.php" method="get"> User : <input class="text" type="text" name="user" size="10" maxlength="8"/> Number : <input class="text" type="text" name="number" size="10" maxlength="8"/>
} else { $defaultDataId = 0; } if (isset($_REQUEST["msg"])) { $msg = $_REQUEST["msg"]; } else { $msg = ""; } $table = $_REQUEST["table"]; if (isset($prevTable) && is_array($prevTable)) { $numPendingTables = count($prevTable); } else { $numPendingTables = 0; } if (isset($_REQUEST[$table])) { list($success, $msg, $id) = updateRecord($db, $table, $d[$table], $updateId); if ($success) { unset($d[$table]); if ($numPendingTables > 0) { // pop one off the previous table stack. $table = array_pop($prevTable); } if (isset($extras["returnURL"]) && $numPendingTables == 0) { if (strpos(urldecode($extras["returnURL"]), '?') === FALSE) { $urlChar = "?"; } else { $urlChar = "&"; } if (isset($extras["returnIdName"])) { header("Location: " . $returnURL . $urlChar . $extras["returnIdName"] . "=" . $id); } else {
function recheioUpdate($fields) { $where = "pp_recheio_id = " . dbString($fields['pp_recheio_id']); unset($fields['pp_recheio_id']); updateRecord("pp_recheio", $fields, $where); }
function doUpdate() { $uid = substr($_GET['uid'], strlen('event-')); $oldCalName = $_GET['oldCalName']; $calName = $_GET['calName']; $eventStart = $_GET['eventStart']; $eventEnd = $_GET['eventEnd']; $eventText = $_GET['eventText']; if ($calName == null) { return "failed\nno calendar name"; } if ($uid == '' && ($eventStart == null || $eventEnd == null)) { return "failed\nno start/end date"; } if ($uid == '' && $eventText == '') { return "success\nhaven't created event because text is empty"; } if ($oldCalName != null) { // we have an old calendar, so move event from that cal to $calName // read in old cal // get event from old cal // read in new cal // append event } $filename = CALENDAR_DIR . $calName . '.ics'; // backup calendar if (!copy($filename, $filename . '.bak')) { return "failed\nunable to backup calendar: {$filename}"; } // get calendar file specified if (!is_writable($filename)) { return "failed\ncalendar is not writeable: {$filename}"; } $lines = file($filename); if ($lines === FALSE) { return "failed\nunable to read in calendar: {$filename}"; } $handle = fopen($filename, 'w'); if ($handle == null) { return "failed\nunable to open calendar file for writing: {$filename}"; } $result = "failed:\nunknown reason"; if ($uid == '') { $uid = uniqid('MONKET-', true); // create ical record $record = ""; $record .= "BEGIN:VEVENT\n"; $record .= "DTSTART;VALUE=DATE:" . $eventStart . "\n"; $record .= "DTEND;VALUE=DATE:" . $eventEnd . "\n"; $record .= "SUMMARY:" . $eventText . "\n"; $record .= "UID:" . $uid . "\n"; $record .= "DTSTAMP:" . date('Ymd\\THis') . "\n"; $record .= "END:VEVENT\n"; $result = "failed\ndid not write record"; foreach ($lines as $line) { if (trim($line) == 'END:VCALENDAR') { $result = 'success' . "\n" . $uid; fputs($handle, $record); } fputs($handle, $line); } } else { $result = "failed\nunable to edit event"; $record = null; foreach ($lines as $line) { $value = trim($line); if ($value == 'BEGIN:VEVENT') { $record = $line; } else { if (startsWith($value, 'UID:')) { $record .= $line; $recordUid = trim(substr($value, strlen('UID:'))); } else { if ($value == 'END:VEVENT') { $record .= $line; if ($uid == $recordUid) { $record = updateRecord($record, $eventText, $eventStart, $eventEnd); } fputs($handle, $record); $record = null; $recordUid = null; $result = "success"; } else { if ($record !== null) { $record .= $line; } else { fputs($handle, $line); } } } } } } fclose($handle); echo $result; }
require_once BADGER_ROOT . '/modules/account/PlannedTransaction.class.php'; require_once BADGER_ROOT . '/modules/account/accountCommon.php'; $redirectPage = ""; $pageTitle = getBadgerTranslation2('accountTransaction', 'pageTitle'); $am = new AccountManager($badgerDb); $catm = new CategoryManager($badgerDb); if (isset($_GET['action'])) { switch (getGPC($_GET, 'action')) { case 'delete': deleteRecord(); break; case 'save': $accountID = getGPC($_POST, 'hiddenAccID', 'integer'); if (isset($_POST['hiddenID'])) { //add record, update record updateRecord($accountID, getGPC($_POST, 'hiddenID'), getGPC($_POST, 'hiddenType')); $redirectPage = getRedirectPage($accountID); header("Location: {$redirectPage}"); } break; case 'new': case 'edit': //frontend form for edit or insert if (isset($_GET['accountID'])) { // account was selected previously $accountID = getGPC($_GET, 'accountID', 'integer'); $redirectPage = getRedirectPage($accountID); } else { // no account was selected previously // -> user has to choose one $accountID = "choose";
<? include('dbconfig.php'); include('library.php'); connect2DB(); // as per values specified in config file if ( isset($_GET['order']) ) { $query = "SELECT * FROM orders WHERE orders_id ='" . $_GET['order'] . "'"; if ( recordExists($query) ) { // Update the record $query = "UPDATE orders SET abo_status = '0', orders_status = '1' WHERE orders_id ='" . $_GET['order'] . "'"; if (updateRecord($query) ) { echo "Order " . $_GET['order'] . " geinitialiseerd."; } else { echo "Er deed zich een fout voor, gelieve opnieuw te proberen."; } } else { echo "Er is geen order gevonden met id " . $_GET['order']; } } else { echo "Gelieve een order nummer in te geven."; } ?>
} else { echo '<td> </td>'; } } ?> </tr> <tr><td> </td></tr> <tr><td>WB</td> <?php for ($val = 1; $val < 6; $val++) { if ($val == 5) { $r_name = GetValue('addressname', 'register', 'address="' . $col1 . '"'); echo '<td id="wb_value">' . $r_name . ": " . $str . '</td>'; $arrVal['updatedvalue'] = $str; updateRecord($arrVal, 'register', "addressname='{$r_name}'"); } else { echo '<td> </td>'; } } ?> </tr>--> <!--</table> </td> </tr>--> </table> </div> </body> <?php function updateRecord($arrayValues, $table, $condition, $autoCommit = "yes")
function provaClassificacaoUpdateStatus($id_classificacao, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('provas_classificacoes', $fields, 'id_classificacao = ' . dbInteger($id_classificacao)); }
function elementoEquipaUpdateStatus($id_elemento_equipa, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('elementos_equipas', $fields, 'id_elemento_equipa = ' . dbInteger($id_elemento_equipa)); }
function insertRecord($rtyID = null) { // check if there is preference for OwnerGroup and visibility $addRecDefaults = getDefaultOwnerAndibility($_REQUEST); $usrID = get_user_id(); // Try to insert anything in POST as details of a new Record. // We do this by creating a stub record, and then updating it. mysql__insert("Records", array("rec_Added" => date('Y-m-d H:i:s'), "rec_AddedByUGrpID" => get_user_id(), "rec_RecTypeID" => intval($rtyID), "rec_ScratchPad" => @$_REQUEST["notes"] ? $_REQUEST["notes"] : null, "rec_OwnerUGrpID" => $addRecDefaults[1], "rec_NonOwnerVisibility" => $addRecDefaults[2], "rec_URL" => @$_REQUEST["rec_url"] ? $_REQUEST["rec_url"] : "")); $_REQUEST["recID"] = $recID = mysql_insert_id(); if ($recID) { if ($usrID) { mysql__insert('usrBookmarks', array('bkm_recID' => $recID, 'bkm_Added' => date('Y-m-d H:i:s'), 'bkm_Modified' => date('Y-m-d H:i:s'), 'bkm_UGrpID' => $usrID)); } updateRecord($recID, $rtyID); return true; } else { return false; } }
function reparadorUpdate($fields) { $where = "rep_id = " . dbString($fields['rep_id']); unset($fields['rep_id']); updateRecord("reparador", $fields, $where); }
function visitanteUpdateStatus($id, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('visitantes', $fields, 'id_visitante = ' . dbInteger($id)); }
function modifBolosUpdate($fields) { $where = "pp_modif_id = " . dbString($fields['pp_modif_id']); unset($fields['pp_modif_id']); updateRecord("pp_modif_bolos", $fields, $where); }
//user must be logged-in to view this page securePage(); // include no cache headers include $path_to_dynamik . "no_cache.inc.php"; // include format functions include $path_to_dynamik . "format_functions.inc.php"; // include form functions include $path_to_dynamik . "form_functions.inc.php"; // include DB fetch functions include $path_to_dynamik . "db_fetch_fncs.inc.php"; // include DB data manipulation functions include $path_to_dynamik . "db_ops_fncs.inc.php"; // init variables $order = trim($_POST["order"]); // init page va $listings_page = "index.php"; // make sure that an order list is set if ($order == "") { header("Location: " . $listings_page); exit; } // go through the array of ids in the order they've been reassigned in, and update each record in [employees] $new_order_array = explode("|", $order); // loop through array for ($i = 0; $i < sizeof($new_order_array); $i++) { // define query to update updateRecord("rentals", "rank = " . intval($i + 1), "id = '" . intval($new_order_array[$i]) . "' "); } // send to main page header("Location: index.php?action=edit&result=update"); exit;
<?php ob_start(); session_start(); $table = isset($_POST['table']) ? htmlentities($_POST['table']) : ""; $condition = isset($_POST['condition']) ? $_POST['condition'] : ""; $fields = isset($_POST['fields']) ? $_POST['fields'] : ""; $datetime = date("Y-m-d H:i:s"); $update_info = $fields; $update_info['updatedate'] = $datetime; $return = updateRecord($update_info, $table, stripslashes($condition)); echo $return; ob_end_flush(); function isHexadecimalString($str) { if (preg_match("/^[a-f0-9]{1,}\$/is", $str)) { return 1; } else { return 0; } } function updateRecord($arrayValues, $table, $condition, $autoCommit = "yes") { include_once 'connection.php'; mysqli_autocommit($conn, false); $table_value = ""; if (empty($arrayValues)) { echo "Incomplete Parameters Passed"; die; } if (!is_array($arrayValues)) {
function massaUpdate($fields) { $where = "pp_massa_id = " . dbString($fields['pp_massa_id']); unset($fields['pp_massa_id']); updateRecord("pp_massa", $fields, $where); }
function usersUpdate($fields) { $where = "us_id = " . dbString($fields['us_id']); unset($fields['us_id']); updateRecord("users", $fields, $where); }
//user must be logged-in to view this page securePage(); // include no cache headers include $path_to_dynamik . "no_cache.inc.php"; // include format functions include $path_to_dynamik . "format_functions.inc.php"; // include form functions include $path_to_dynamik . "form_functions.inc.php"; // include DB fetch functions include $path_to_dynamik . "db_fetch_fncs.inc.php"; // include DB data manipulation functions include $path_to_dynamik . "db_ops_fncs.inc.php"; // init variables $order = trim($_POST["order"]); // init page va $listings_page = "activities.php"; // make sure that an order list is set if ($order == "") { header("Location: " . $listings_page); exit; } // go through the array of ids in the order they've been reassigned in, and update each record in [employees] $new_order_array = explode("|", $order); // loop through array for ($i = 0; $i < sizeof($new_order_array); $i++) { // define query to update updateRecord("activities", "rank = " . intval($i + 1), "id = '" . intval($new_order_array[$i]) . "' "); } // send to main page header("Location: activities.php?action=edit&result=update"); exit;
function localUpdateStatus($id, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('locais', $fields, 'id_local = ' . dbInteger($id)); }
function modalidadeUpdateStatus($id, $status) { $fields = array(); $fields['status'] = dbString($status); updateRecord('modalidades', $fields, 'id_modalidade = ' . dbInteger($id)); }
function insertRecord($rtyID = null) { // check if there is preference for OwnerGroup and visibility $addRecDefaults = @$_SESSION[HEURIST_SESSION_DB_PREFIX . 'heurist']["display-preferences"]['addRecDefaults']; if ($addRecDefaults) { if ($addRecDefaults[1]) { $userDefaultOwnerGroupID = intval($addRecDefaults[1]); } if ($addRecDefaults[2]) { $userDefaultVisibility = $addRecDefaults[2]; } } $usrID = get_user_id(); //set owner to passed value else to NEWREC default if defined else to user //ART $owner = @$_POST["owner"]?$_POST["owner"]:( defined("HEURIST_NEWREC_OWNER_ID") ? HEURIST_NEWREC_OWNER_ID : get_user_id()); //ART $owner = ((@$_POST["owner"] || @$_POST["owner"] === '0') ? intval($_POST["owner"]) :(defined('HEURIST_NEWREC_OWNER_ID') ? HEURIST_NEWREC_OWNER_ID : get_user_id())); $owner = is_numeric(@$_POST['rec_owner']) ? intval($_POST['rec_owner']) : (is_numeric(@$userDefaultOwnerGroupID) ? $userDefaultOwnerGroupID : (defined('HEURIST_NEWREC_OWNER_ID') ? HEURIST_NEWREC_OWNER_ID : intval($usrID))); $nonownervisibility = @$_POST['rec_visibility'] ? strtolower($_POST['rec_visibility']) : (@$userDefaultVisibility ? $userDefaultVisibility : (defined('HEURIST_NEWREC_ACCESS') ? HEURIST_NEWREC_ACCESS : 'viewable')); //error_log(" in insertRecord"); // if non zero (everybody group, test if user is member, if not then set owner to user if (intval($owner) != 0 && !in_array($owner, get_group_ids())) { $owner = get_user_id(); } // Try to insert anything in POST as details of a new Record. // We do this by creating a stub record, and then updating it. mysql__insert("Records", array("rec_Added" => date('Y-m-d H:i:s'), "rec_AddedByUGrpID" => get_user_id(), "rec_RecTypeID" => intval($rtyID), "rec_ScratchPad" => @$_POST["notes"] ? $_POST["notes"] : null, "rec_OwnerUGrpID" => $owner, "rec_NonOwnerVisibility" => $nonownervisibility, "rec_URL" => @$_POST["rec_url"] ? $_POST["rec_url"] : "")); $_REQUEST["recID"] = $recID = mysql_insert_id(); if ($recID) { //error_log(" in insertRecord recID = $recID"); if ($usrID) { mysql__insert('usrBookmarks', array('bkm_recID' => $recID, 'bkm_Added' => date('Y-m-d H:i:s'), 'bkm_Modified' => date('Y-m-d H:i:s'), 'bkm_UGrpID' => $usrID)); } updateRecord($recID, $rtyID); return true; } else { return false; } }
function modifrepUpdate($fields) { $where = "id = " . dbString($fields['id']); unset($fields['id']); updateRecord("modifrep", $fields, $where); }
function coberturaUpdate($fields) { $where = "pp_cobertura_id = " . dbString($fields['pp_cobertura_id']); unset($fields['pp_cobertura_id']); updateRecord("pp_cobertura", $fields, $where); }
} $query = "SELECT * FROM ".products_plant." WHERE products_model='".$arr[0]."' AND plant_maat='".$arr[3]."'"; if (recordExists($query)) { if ($arr[7] == 'DELETE') //Status { $query = "DELETE FROM products_plant WHERE products_model='".$arr[0]."' AND plant_maat = '".$arr[3]."'"; if (deleteFrom($query)) echo "Record Delete for the plant = ".$arr[0]." AND plant_mmat = ".$arr[3]."<br />"; } else { // Update the record $query = "UPDATE products_plant SET plant_sort='".$arr[1]."',plant_mc='".$arr[2]."',plant_description='".$arr[4]."',plant_price='".$arr[5]."',plant_vrij='".$arr[6] ."' WHERE products_model='".$arr[0]."' AND plant_maat='".$arr[3]."'"; if (updateRecord($query)) { echo "Record Updated for the plant ='".$arr[0]."' AND plant_maat=".$arr[3]."<br>"; } } } elseif ($arr[7] != 'DELETE') { $arr = array_slice($arr, 0, 7); //First 7 values; // Add new record $sql = "insert into products_plant (products_model, plant_sort, plant_mc, plant_maat, plant_description, plant_price, plant_vrij) values ('".implode("','", $arr)."')"; mysql_query ($sql); // echo $sql ."<br>\n"; if (mysql_error()) { echo mysql_error()."<br>\n"; } else { echo "Record Added for the planten maten='".$arr[0]."' AND plant_maat=".$arr[3]."<br>"; } } } } else { die ("The filename you have specified does not exist"); }
function revertRevision($params) { /* * Script will attempt to revert to the content record by revertid ** REQUIRED PARAMS id - primary key of non-revision record revertid - primary key of the record to be reverted back instead of non-revision record */ // make sure we have a content id of the non-revision if (isset($params['id']) && isset($params['revertid'])) { // 1. duplicate the record by provided id and set the id of the new record to $autoIncrementContent $autoIncrementContent = getAutoIncrement('content'); // get auto-increment for the new record duplicateRows('content', 'id', $params['id'], $autoIncrementContent); // 2. make the revision of the duplicated record : // a. change is_revision to '1' $paramsUpd = array(); $paramsUpd['tablename'] = "content"; $paramsUpd['id'] = $autoIncrementContent; $paramsUpd['is_revision'] = '1'; updateRecord($paramsUpd); // 3. copy all the fields of revertid record to id record // and change is_revision to '0' $sql = "SELECT content.* from `content` WHERE id = " . $params['revertid']; $result = queryDatabase($sql); $rows = $result->fetch(PDO::FETCH_ASSOC); foreach ($rows as $key => $value) { if ($key != 'id' && $key != 'is_revision') { $rowsUpd[$key] = $value; } } $rowsUpd['tablename'] = "content"; $rowsUpd['id'] = $params['id']; $rowsUpd['is_revision'] = '0'; $rowsUpd['modifieddate'] = time(); updateRecord($rowsUpd); // 4. delete the record by provided revertid $sql = "DELETE FROM `content` WHERE id = " . $params['revertid']; if (!($result2 = queryDatabase($sql))) { die("Query Failed: " . $result2->errorInfo()); } sendSuccess(); } else { die("No id provided."); } }