function list_diff($a, $b) { // print("a: ".listfmt($a)."<br />\n"); // print("b: ".listfmt($b)."<br />\n"); $o = array(); if (count($a) == 0) { foreach ($b as $new) { array_push($o, added($new)); } return $o; } $l = reset($a); $r = reset($b); // print("Comparing $l and $r<br />\n"); if ($l == $r) { array_push($o, same($l)); array_shift($a); array_shift($b); } else { // print("$l and $r are different; resynching\n"); list($added, $remain) = find_best_match($a, $b); if (count($added) > 0) { foreach ($added as $new) { array_push($o, added($new)); } $b = $remain; // print("Found ${added[0]}; ". count($remain). " Remain\n"); } else { array_push($o, deleted($l)); array_shift($a); // array_shift($b); } } $n = list_diff($a, $b); foreach ($n as $new) { $o[] = $new; } return $o; }
if (mysqli_query($con, $sql)) { header('location: /inhome.php'); } else { echo errorphp($con); } } } /* DELETES */ if (isset($_POST['impd_del'])) { deleted($con, 'imp_dates', 'dates_id', 'imp_dates.php'); } if (isset($_POST['impn_del'])) { deleted($con, 'imp_notes', 'note_id', 'imp_notes.php'); } if (isset($_POST['del'])) { deleted($con, 'spec_list', 'spec_id', 'inhome.php'); } /* * ******************************GETS* */ /* if(isset($_POST['is_active_x'])){ for ($i = 0; $i < 100; $i++) { if (isset($_POST["date$i"])) { set_active($con, 'imp_dates', 1, 'dates_id', $i); }} header('location: /imp_dates.php'); } if(isset($_POST['isnt_active_x'])){ for ($i = 0; $i < 100; $i++) {