diff --git a/includes/titleranks-editor.php b/includes/titleranks-editor.php
index 14d793f..469c6bd 100644
--- a/includes/titleranks-editor.php
+++ b/includes/titleranks-editor.php
@@ -6,21 +6,16 @@ error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
# delete the above when shit finally works
-# $tid = $_SESSION['tid'] = titlenameid from database
-# $stid = $_POST['editstitle'] = stnameid from database and it should return an array of numbers
-
echo '
';
echo '
';
diff --git a/includes/titleranks-update.php b/includes/titleranks-update.php
index 00eb256..5dd6d7a 100644
--- a/includes/titleranks-update.php
+++ b/includes/titleranks-update.php
@@ -1,6 +1,42 @@
';
-echo 'delete the specified title rank(s), but require a verification page!
';
+# delete this block when shit finally works.
+ini_set('display_errors', 'on');
+error_reporting(E_ALL);
+mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
+# delete the above when shit finally works
+
+if (isset($_POST['delsubtitle'])) {
+ if ($_POST['delsubtitle'] =="yes") {
+ // this title makes you verify that you want to delete this title
+ echo '
';
+ } else if ($_POST['delsubtitle'] == "iamsure") {
+ // this section actually deletes the title rank(s)
+ # need to deal with array data eventually
+ $stmtdel = $con->prepare("DELETE FROM gwsubtitles WHERE titlenameid = ?");
+ $stmtdel->bind_param("i", $_POST['titlenameid']);
+ $stmtdel->execute();
+ $stmtdel->close();
+ echo 'Title rank(s) have been deleted, redirecting!';
+ header ("Refresh:1; url=titlemanager.php");
+ }
+} else {
+ // this section updates the title name
+ if ($upd = $con->prepare("UPDATE gwsubtitles SET stname = ?, stpoints = ?, strank = ? WHERE titlenameid = ? AND stnameid = ?")) {
+ $upd->bind_param("siiii", $stname, $stpoints, $strank, $titlenameid, $stnameid);
+ for ($i = 0; $i < count($_POST['stname']); $i++) {
+ $stname = $_POST['stname'][$i];
+ $stpoints = $_POST['stpoints'][$i];
+ $strank = $_POST['strank'][$i];
+ $titlenameid = $_POST['titlenameid'][$i];
+ $stnameid = $_POST['stnameid'][$i];
+ $upd->execute();
+ }
+ $upd->close();
+ }
+ echo 'Title rank(s) updated, redirecting!';
+ header ("Refresh:1; url=titlemanager.php");
+}
echo 'Return to title manager';
?>
\ No newline at end of file