PageRenderTime 37ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/osj-osj2dusersdelete.php

http://osjobber.googlecode.com/
PHP | 622 lines | 461 code | 76 blank | 85 comment | 72 complexity | 9a10d6ba7afc82b506ad4c607f7e7db1 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0
  1. <?php
  2. define("EW_PAGE_ID", "delete", TRUE); // Page ID
  3. define("EW_TABLE_NAME", 'osj-users', TRUE);
  4. ?>
  5. <?php
  6. session_start(); // Initialize session data
  7. ob_start(); // Turn on output buffering
  8. ?>
  9. <?php include "osj-ewcfg50.php" ?>
  10. <?php include "osj-ewmysql50.php" ?>
  11. <?php include "osj-phpfn50.php" ?>
  12. <?php include "osj-osj2dusersinfo.php" ?>
  13. <?php include "osj-userfn50.php" ?>
  14. <?php
  15. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  16. header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
  17. header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1
  18. header("Cache-Control: post-check=0, pre-check=0", false);
  19. header("Pragma: no-cache"); // HTTP/1.0
  20. ?>
  21. <?php
  22. // Open connection to the database
  23. $conn = ew_Connect();
  24. ?>
  25. <?php
  26. $Security = new cAdvancedSecurity();
  27. ?>
  28. <?php
  29. if (!$Security->IsLoggedIn()) $Security->AutoLogin();
  30. $Security->LoadCurrentUserLevel('osj-users');
  31. if (!$Security->IsLoggedIn()) {
  32. $Security->SaveLastUrl();
  33. Page_Terminate("osj-login.php");
  34. }
  35. if (!$Security->CanDelete()) {
  36. $Security->SaveLastUrl();
  37. Page_Terminate("osj-osj2duserslist.php");
  38. }
  39. if ($Security->IsLoggedIn() && $Security->CurrentUserID() == "") {
  40. $_SESSION[EW_SESSION_MESSAGE] = "You do not have the right permission to view the page";
  41. Page_Terminate("osj-login.php");
  42. }
  43. ?>
  44. <?php
  45. // Common page loading event (in userfn*.php)
  46. Page_Loading();
  47. ?>
  48. <?php
  49. // Page load event, used in current page
  50. Page_Load();
  51. ?>
  52. <?php
  53. $osj2Dusers->Export = @$_GET["export"]; // Get export parameter
  54. $sExport = $osj2Dusers->Export; // Get export parameter, used in header
  55. $sExportFile = $osj2Dusers->TableVar; // Get export file, used in header
  56. ?>
  57. <?php
  58. // Load Key Parameters
  59. $sKey = "";
  60. $bSingleDelete = TRUE; // Initialize as single delete
  61. $arRecKeys = array();
  62. $nKeySelected = 0; // Initialize selected key count
  63. $sFilter = "";
  64. if (@$_GET["user_id"] <> "") {
  65. $osj2Dusers->user_id->setQueryStringValue($_GET["user_id"]);
  66. if (!is_numeric($osj2Dusers->user_id->QueryStringValue)) {
  67. Page_Terminate($osj2Dusers->getReturnUrl()); // Prevent sql injection, exit
  68. }
  69. $sKey .= $osj2Dusers->user_id->QueryStringValue;
  70. } else {
  71. $bSingleDelete = FALSE;
  72. }
  73. if ($bSingleDelete) {
  74. $nKeySelected = 1; // Set up key selected count
  75. $arRecKeys[0] = $sKey;
  76. } else {
  77. if (isset($_POST["key_m"])) { // Key in form
  78. $nKeySelected = count($_POST["key_m"]); // Set up key selected count
  79. $arRecKeys = ew_StripSlashes($_POST["key_m"]);
  80. }
  81. }
  82. if ($nKeySelected <= 0) Page_Terminate($osj2Dusers->getReturnUrl()); // No key specified, exit
  83. // Build filter
  84. foreach ($arRecKeys as $sKey) {
  85. $sFilter .= "(";
  86. // Set up key field
  87. $sKeyFld = $sKey;
  88. if (!is_numeric($sKeyFld)) {
  89. Page_Terminate($osj2Dusers->getReturnUrl()); // Prevent sql injection, exit
  90. }
  91. $sFilter .= "`user_id`=" . ew_AdjustSql($sKeyFld) . " AND ";
  92. if (substr($sFilter, -5) == " AND ") $sFilter = substr($sFilter, 0, strlen($sFilter)-5) . ") OR ";
  93. }
  94. if (substr($sFilter, -4) == " OR ") $sFilter = substr($sFilter, 0, strlen($sFilter)-4);
  95. // Set up filter (Sql Where Clause) and get Return Sql
  96. // Sql constructor in osj2Dusers class, osj2Dusersinfo.php
  97. $osj2Dusers->CurrentFilter = $sFilter;
  98. // Get action
  99. if (@$_POST["a_delete"] <> "") {
  100. $osj2Dusers->CurrentAction = $_POST["a_delete"];
  101. } else {
  102. $osj2Dusers->CurrentAction = "I"; // Display record
  103. }
  104. switch ($osj2Dusers->CurrentAction) {
  105. case "D": // Delete
  106. $osj2Dusers->SendEmail = TRUE; // Send email on delete success
  107. if (DeleteRows()) { // delete rows
  108. $_SESSION[EW_SESSION_MESSAGE] = "Delete Successful"; // Set up success message
  109. Page_Terminate($osj2Dusers->getReturnUrl()); // Return to caller
  110. }
  111. }
  112. // Load records for display
  113. $rs = LoadRecordset();
  114. $nTotalRecs = $rs->RecordCount(); // Get record count
  115. if ($nTotalRecs <= 0) { // No record found, exit
  116. $rs->Close();
  117. Page_Terminate($osj2Dusers->getReturnUrl()); // Return to caller
  118. }
  119. ?>
  120. <?php include "osj-header.php" ?>
  121. <script type="text/javascript">
  122. <!--
  123. var EW_PAGE_ID = "delete"; // Page id
  124. var EW_SHOW_HIGHLIGHT = "Show highlight";
  125. var EW_HIDE_HIGHLIGHT = "Hide highlight";
  126. //-->
  127. </script>
  128. <script language="JavaScript" type="text/javascript">
  129. <!--
  130. // Write your client script here, no need to add script tags.
  131. // To include another .js script, use:
  132. // ew_ClientScriptInclude("my_javascript.js");
  133. //-->
  134. </script>
  135. <p><span class="phpmaker">Delete from TABLE: Users<br><br><a href="<?php echo $osj2Dusers->getReturnUrl() ?>">Go Back</a></span></p>
  136. <?php
  137. if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
  138. ?>
  139. <p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
  140. <?php
  141. $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
  142. }
  143. ?>
  144. <form action="osj-osj2dusersdelete.php" method="post">
  145. <p>
  146. <input type="hidden" name="a_delete" id="a_delete" value="D">
  147. <?php foreach ($arRecKeys as $sKey) { ?>
  148. <input type="hidden" name="key_m[]" id="key_m[]" value="<?php echo ew_HtmlEncode($sKey) ?>">
  149. <?php } ?>
  150. <table class="ewTable">
  151. <tr class="ewTableHeader">
  152. <td valign="top">User ID</td>
  153. <td valign="top">Creation Date</td>
  154. <td valign="top">Edit Date</td>
  155. <td valign="top">Email</td>
  156. <td valign="top">Password</td>
  157. <td valign="top">User Level</td>
  158. <td valign="top">User Status</td>
  159. </tr>
  160. <?php
  161. $nRecCount = 0;
  162. $i = 0;
  163. while (!$rs->EOF) {
  164. $nRecCount++;
  165. // Set row class and style
  166. $osj2Dusers->CssClass = "ewTableRow";
  167. $osj2Dusers->CssStyle = "";
  168. // Display alternate color for rows
  169. if ($nRecCount % 2 <> 1) {
  170. $osj2Dusers->CssClass = "ewTableAltRow";
  171. }
  172. // Get the field contents
  173. LoadRowValues($rs);
  174. // Render row value
  175. $osj2Dusers->RowType = EW_ROWTYPE_VIEW; // view
  176. RenderRow();
  177. ?>
  178. <tr<?php echo $osj2Dusers->DisplayAttributes() ?>>
  179. <td<?php echo $osj2Dusers->user_id->CellAttributes() ?>>
  180. </td>
  181. <td<?php echo $osj2Dusers->user_creation_date->CellAttributes() ?>>
  182. </td>
  183. <td<?php echo $osj2Dusers->user_edit_date->CellAttributes() ?>>
  184. </td>
  185. <td<?php echo $osj2Dusers->user_email->CellAttributes() ?>>
  186. <div<?php echo $osj2Dusers->user_email->ViewAttributes() ?>><?php echo $osj2Dusers->user_email->ViewValue ?></div>
  187. </td>
  188. <td<?php echo $osj2Dusers->user_password->CellAttributes() ?>>
  189. <div<?php echo $osj2Dusers->user_password->ViewAttributes() ?>><?php echo $osj2Dusers->user_password->ViewValue ?></div>
  190. </td>
  191. <td<?php echo $osj2Dusers->user_level->CellAttributes() ?>>
  192. <div<?php echo $osj2Dusers->user_level->ViewAttributes() ?>><?php echo $osj2Dusers->user_level->ViewValue ?></div>
  193. </td>
  194. <td<?php echo $osj2Dusers->user_status->CellAttributes() ?>>
  195. <div<?php echo $osj2Dusers->user_status->ViewAttributes() ?>><?php echo $osj2Dusers->user_status->ViewValue ?></div>
  196. </td>
  197. </tr>
  198. <?php
  199. $rs->MoveNext();
  200. }
  201. $rs->Close();
  202. ?>
  203. </table>
  204. <p>
  205. <input type="submit" name="Action" id="Action" value="Confirm Delete">
  206. </form>
  207. <script language="JavaScript" type="text/javascript">
  208. <!--
  209. // Write your table-specific startup script here
  210. // document.write("page loaded");
  211. //-->
  212. </script>
  213. <?php include "osj-footer.php" ?>
  214. <?php
  215. // If control is passed here, simply terminate the page without redirect
  216. Page_Terminate();
  217. // -----------------------------------------------------------------
  218. // Subroutine Page_Terminate
  219. // - called when exit page
  220. // - clean up connection and objects
  221. // - if url specified, redirect to url, otherwise end response
  222. function Page_Terminate($url = "") {
  223. global $conn;
  224. // Page unload event, used in current page
  225. Page_Unload();
  226. // Global page unloaded event (in userfn*.php)
  227. Page_Unloaded();
  228. // Close Connection
  229. $conn->Close();
  230. // Go to url if specified
  231. if ($url <> "") {
  232. ob_end_clean();
  233. header("Location: $url");
  234. }
  235. exit();
  236. }
  237. ?>
  238. <?php
  239. // ------------------------------------------------
  240. // Function DeleteRows
  241. // - Delete Records based on current filter
  242. function DeleteRows() {
  243. global $conn, $Security, $osj2Dusers;
  244. $DeleteRows = TRUE;
  245. $sWrkFilter = $osj2Dusers->CurrentFilter;
  246. if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
  247. $sWrkFilter = $osj2Dusers->AddUserIDFilter($sWrkFilter, $Security->CurrentUserID()); // Add User ID filter
  248. }
  249. // Set up filter (Sql Where Clause) and get Return Sql
  250. // Sql constructor in osj2Dusers class, osj2Dusersinfo.php
  251. $osj2Dusers->CurrentFilter = $sWrkFilter;
  252. $sSql = $osj2Dusers->SQL();
  253. $conn->raiseErrorFn = 'ew_ErrorFn';
  254. $rs = $conn->Execute($sSql);
  255. $conn->raiseErrorFn = '';
  256. if ($rs === FALSE) {
  257. return FALSE;
  258. } elseif ($rs->EOF) {
  259. $_SESSION[EW_SESSION_MESSAGE] = "No records found"; // No record found
  260. $rs->Close();
  261. return FALSE;
  262. }
  263. $conn->BeginTrans();
  264. WriteAuditTrailDummy("*** batch delete begin ***"); // Batch delete begin
  265. // Clone old rows
  266. $rsold = ($rs) ? $rs->GetRows() : array();
  267. if ($rs) $rs->Close();
  268. // Call row deleting event
  269. if ($DeleteRows) {
  270. foreach ($rsold as $row) {
  271. $DeleteRows = $osj2Dusers->Row_Deleting($row);
  272. if (!$DeleteRows) break;
  273. }
  274. }
  275. if ($DeleteRows) {
  276. $sKey = "";
  277. foreach ($rsold as $row) {
  278. $sThisKey = "";
  279. if ($sThisKey <> "") $sThisKey .= EW_COMPOSITE_KEY_SEPARATOR;
  280. $sThisKey .= $row['user_id'];
  281. $conn->raiseErrorFn = 'ew_ErrorFn';
  282. $DeleteRows = $conn->Execute($osj2Dusers->DeleteSQL($row)); // Delete
  283. $conn->raiseErrorFn = '';
  284. if ($DeleteRows === FALSE)
  285. break;
  286. if ($sKey <> "") $sKey .= ", ";
  287. $sKey .= $sThisKey;
  288. }
  289. } else {
  290. // Set up error message
  291. if ($osj2Dusers->CancelMessage <> "") {
  292. $_SESSION[EW_SESSION_MESSAGE] = $osj2Dusers->CancelMessage;
  293. $osj2Dusers->CancelMessage = "";
  294. } else {
  295. $_SESSION[EW_SESSION_MESSAGE] = "Delete cancelled";
  296. }
  297. }
  298. if ($DeleteRows) {
  299. $conn->CommitTrans(); // Commit the changes
  300. if ($DeleteRows) {
  301. foreach ($rsold as $row) {
  302. WriteAuditTrailOnDelete($row);
  303. }
  304. }
  305. WriteAuditTrailDummy("*** batch delete success ***"); // Batch delete success
  306. } else {
  307. $conn->RollbackTrans(); // Rollback changes
  308. WriteAuditTrailDummy("*** batch delete rollback ***"); // Batch delete rollback
  309. }
  310. // Call recordset deleted event
  311. if ($DeleteRows) {
  312. foreach ($rsold as $row) {
  313. $osj2Dusers->Row_Deleted($row);
  314. }
  315. }
  316. return $DeleteRows;
  317. }
  318. ?>
  319. <?php
  320. // Load recordset
  321. function LoadRecordset($offset = -1, $rowcnt = -1) {
  322. global $conn, $osj2Dusers;
  323. // Call Recordset Selecting event
  324. $osj2Dusers->Recordset_Selecting($osj2Dusers->CurrentFilter);
  325. // Load list page sql
  326. $sSql = $osj2Dusers->SelectSQL();
  327. if ($offset > -1 && $rowcnt > -1) $sSql .= " LIMIT $offset, $rowcnt";
  328. // Load recordset
  329. $conn->raiseErrorFn = 'ew_ErrorFn';
  330. $rs = $conn->Execute($sSql);
  331. $conn->raiseErrorFn = '';
  332. // Call Recordset Selected event
  333. $osj2Dusers->Recordset_Selected($rs);
  334. return $rs;
  335. }
  336. ?>
  337. <?php
  338. // Load row based on key values
  339. function LoadRow() {
  340. global $conn, $Security, $osj2Dusers;
  341. $sFilter = $osj2Dusers->SqlKeyFilter();
  342. if (!is_numeric($osj2Dusers->user_id->CurrentValue)) {
  343. return FALSE; // Invalid key, exit
  344. }
  345. $sFilter = str_replace("@user_id@", ew_AdjustSql($osj2Dusers->user_id->CurrentValue), $sFilter); // Replace key value
  346. if ($Security->CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin
  347. $sFilter = $osj2Dusers->AddUserIDFilter($sFilter, $Security->CurrentUserID()); // Add User ID filter
  348. }
  349. // Call Row Selecting event
  350. $osj2Dusers->Row_Selecting($sFilter);
  351. // Load sql based on filter
  352. $osj2Dusers->CurrentFilter = $sFilter;
  353. $sSql = $osj2Dusers->SQL();
  354. if ($rs = $conn->Execute($sSql)) {
  355. if ($rs->EOF) {
  356. $LoadRow = FALSE;
  357. } else {
  358. $LoadRow = TRUE;
  359. $rs->MoveFirst();
  360. LoadRowValues($rs); // Load row values
  361. // Call Row Selected event
  362. $osj2Dusers->Row_Selected($rs);
  363. }
  364. $rs->Close();
  365. } else {
  366. $LoadRow = FALSE;
  367. }
  368. return $LoadRow;
  369. }
  370. // Load row values from recordset
  371. function LoadRowValues(&$rs) {
  372. global $osj2Dusers;
  373. $osj2Dusers->user_id->setDbValue($rs->fields('user_id'));
  374. $osj2Dusers->user_creation_date->setDbValue($rs->fields('user_creation_date'));
  375. $osj2Dusers->user_edit_date->setDbValue($rs->fields('user_edit_date'));
  376. $osj2Dusers->user_email->setDbValue($rs->fields('user_email'));
  377. $osj2Dusers->user_password->setDbValue($rs->fields('user_password'));
  378. $osj2Dusers->user_level->setDbValue($rs->fields('user_level'));
  379. $osj2Dusers->user_status->setDbValue($rs->fields('user_status'));
  380. }
  381. ?>
  382. <?php
  383. // Render row values based on field settings
  384. function RenderRow() {
  385. global $conn, $Security, $osj2Dusers;
  386. // Call Row Rendering event
  387. $osj2Dusers->Row_Rendering();
  388. // Common render codes for all row types
  389. // user_id
  390. $osj2Dusers->user_id->CellCssStyle = "";
  391. $osj2Dusers->user_id->CellCssClass = "";
  392. // user_creation_date
  393. $osj2Dusers->user_creation_date->CellCssStyle = "";
  394. $osj2Dusers->user_creation_date->CellCssClass = "";
  395. // user_edit_date
  396. $osj2Dusers->user_edit_date->CellCssStyle = "";
  397. $osj2Dusers->user_edit_date->CellCssClass = "";
  398. // user_email
  399. $osj2Dusers->user_email->CellCssStyle = "";
  400. $osj2Dusers->user_email->CellCssClass = "";
  401. // user_password
  402. $osj2Dusers->user_password->CellCssStyle = "";
  403. $osj2Dusers->user_password->CellCssClass = "";
  404. // user_level
  405. $osj2Dusers->user_level->CellCssStyle = "";
  406. $osj2Dusers->user_level->CellCssClass = "";
  407. // user_status
  408. $osj2Dusers->user_status->CellCssStyle = "";
  409. $osj2Dusers->user_status->CellCssClass = "";
  410. if ($osj2Dusers->RowType == EW_ROWTYPE_VIEW) { // View row
  411. // user_id
  412. $osj2Dusers->user_id->CssStyle = "";
  413. $osj2Dusers->user_id->CssClass = "";
  414. $osj2Dusers->user_id->ViewCustomAttributes = "";
  415. // user_creation_date
  416. $osj2Dusers->user_creation_date->ViewValue = ew_FormatDateTime($osj2Dusers->user_creation_date->ViewValue, 6);
  417. $osj2Dusers->user_creation_date->CssStyle = "";
  418. $osj2Dusers->user_creation_date->CssClass = "";
  419. $osj2Dusers->user_creation_date->ViewCustomAttributes = "";
  420. // user_edit_date
  421. $osj2Dusers->user_edit_date->ViewValue = ew_FormatDateTime($osj2Dusers->user_edit_date->ViewValue, 6);
  422. $osj2Dusers->user_edit_date->CssStyle = "";
  423. $osj2Dusers->user_edit_date->CssClass = "";
  424. $osj2Dusers->user_edit_date->ViewCustomAttributes = "";
  425. // user_email
  426. $osj2Dusers->user_email->ViewValue = $osj2Dusers->user_email->CurrentValue;
  427. $osj2Dusers->user_email->CssStyle = "";
  428. $osj2Dusers->user_email->CssClass = "";
  429. $osj2Dusers->user_email->ViewCustomAttributes = "";
  430. // user_password
  431. $osj2Dusers->user_password->ViewValue = "********";
  432. $osj2Dusers->user_password->CssStyle = "";
  433. $osj2Dusers->user_password->CssClass = "";
  434. $osj2Dusers->user_password->ViewCustomAttributes = "";
  435. // user_level
  436. if ($Security->CanAdmin()) { // System admin
  437. if (!is_null($osj2Dusers->user_level->CurrentValue)) {
  438. $sSqlWrk = "SELECT `user_level_name` FROM `osj-user_level` WHERE `user_level_id` = " . ew_AdjustSql($osj2Dusers->user_level->CurrentValue) . "";
  439. $sSqlWrk .= " AND (" . "`user_level_name` != 'Default' AND `user_level_name`!= 'Administrator'" . ")";
  440. $rswrk = $conn->Execute($sSqlWrk);
  441. if ($rswrk) {
  442. if (!$rswrk->EOF) {
  443. $osj2Dusers->user_level->ViewValue = $rswrk->fields('user_level_name');
  444. }
  445. $rswrk->Close();
  446. } else {
  447. $osj2Dusers->user_level->ViewValue = $osj2Dusers->user_level->CurrentValue;
  448. }
  449. } else {
  450. $osj2Dusers->user_level->ViewValue = NULL;
  451. }
  452. } else {
  453. $osj2Dusers->user_level->ViewValue = "********";
  454. }
  455. $osj2Dusers->user_level->CssStyle = "";
  456. $osj2Dusers->user_level->CssClass = "";
  457. $osj2Dusers->user_level->ViewCustomAttributes = "";
  458. // user_status
  459. if (!is_null($osj2Dusers->user_status->CurrentValue)) {
  460. switch ($osj2Dusers->user_status->CurrentValue) {
  461. case "0":
  462. $osj2Dusers->user_status->ViewValue = "Inactive";
  463. break;
  464. case "1":
  465. $osj2Dusers->user_status->ViewValue = "Active";
  466. break;
  467. default:
  468. $osj2Dusers->user_status->ViewValue = $osj2Dusers->user_status->CurrentValue;
  469. }
  470. } else {
  471. $osj2Dusers->user_status->ViewValue = NULL;
  472. }
  473. $osj2Dusers->user_status->CssStyle = "";
  474. $osj2Dusers->user_status->CssClass = "";
  475. $osj2Dusers->user_status->ViewCustomAttributes = "";
  476. // user_id
  477. $osj2Dusers->user_id->HrefValue = "";
  478. // user_creation_date
  479. $osj2Dusers->user_creation_date->HrefValue = "";
  480. // user_edit_date
  481. $osj2Dusers->user_edit_date->HrefValue = "";
  482. // user_email
  483. $osj2Dusers->user_email->HrefValue = "";
  484. // user_password
  485. $osj2Dusers->user_password->HrefValue = "";
  486. // user_level
  487. $osj2Dusers->user_level->HrefValue = "";
  488. // user_status
  489. $osj2Dusers->user_status->HrefValue = "";
  490. } elseif ($osj2Dusers->RowType == EW_ROWTYPE_ADD) { // Add row
  491. } elseif ($osj2Dusers->RowType == EW_ROWTYPE_EDIT) { // Edit row
  492. } elseif ($osj2Dusers->RowType == EW_ROWTYPE_SEARCH) { // Search row
  493. }
  494. // Call Row Rendered event
  495. $osj2Dusers->Row_Rendered();
  496. }
  497. ?>
  498. <?php
  499. // Write Audit Trail start/end for grid update
  500. function WriteAuditTrailDummy($typ) {
  501. $table = 'osj-users';
  502. // Write Audit Trail
  503. $filePfx = "log";
  504. $curDate = date("Y/m/d");
  505. $curTime = date("H:i:s");
  506. $id = ew_ScriptName();
  507. $user = CurrentUserID();
  508. $action = $typ;
  509. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, "", "", "", "");
  510. }
  511. ?>
  512. <?php
  513. // Write Audit Trail (delete page)
  514. function WriteAuditTrailOnDelete(&$rs) {
  515. global $osj2Dusers;
  516. $table = 'osj-users';
  517. // Get key value
  518. $key = "";
  519. if ($key <> "") $key .= EW_COMPOSITE_KEY_SEPARATOR;
  520. $key .= $rs['user_id'];
  521. // Write Audit Trail
  522. $filePfx = "log";
  523. $curDate = date("Y/m/d");
  524. $curTime = date("H:i:s");
  525. $id = ew_ScriptName();
  526. $user = CurrentUserID();
  527. $action = "D";
  528. $newvalue = "";
  529. foreach (array_keys($rs) as $fldname) {
  530. if ($osj2Dusers->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore Blob Field
  531. $oldvalue = ($osj2Dusers->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) ? "<MEMO>" : $rs[$fldname]; // Memo Field
  532. ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, $fldname, $key, $oldvalue, $newvalue);
  533. }
  534. }
  535. }
  536. ?>
  537. <?php
  538. // Page Load event
  539. function Page_Load() {
  540. //echo "Page Load";
  541. }
  542. // Page Unload event
  543. function Page_Unload() {
  544. //echo "Page Unload";
  545. }
  546. ?>