diff --git a/adminlanding.php b/adminlanding.php
index ba900e4..d4014b1 100644
--- a/adminlanding.php
+++ b/adminlanding.php
@@ -7,6 +7,7 @@ if (isset($_SESSION['userid'])){
echo '
Welcome to the admin area! ';
echo 'Title creator / editor here (work in progress) ';
echo 'User editor here (not working yet) ';
+ echo 'testing gwamm and autofilled titles theories Legendary GWAMM ';
include_once ('includes/session-dump.php');
}
include_once ('footer.php');
diff --git a/includes/title-add.php b/includes/title-add.php
index 5ffd134..50576af 100644
--- a/includes/title-add.php
+++ b/includes/title-add.php
@@ -1,8 +1,8 @@
Title Name Title Type Max Rank Auto filled? ';
+ echo '';
}
?>
\ No newline at end of file
diff --git a/includes/title-editor.php b/includes/title-editor.php
index d62ed49..683c855 100644
--- a/includes/title-editor.php
+++ b/includes/title-editor.php
@@ -1,7 +1,7 @@
';
- echo 'titlenameid titlename titletype titlemaxrank autofilled ';
+ echo ' ';
+ echo '
';
echo ' ';
echo 'Return to title manager ';
}
diff --git a/includes/title-submit.php b/includes/title-submit.php
index 525f3e0..73aaf8c 100644
--- a/includes/title-submit.php
+++ b/includes/title-submit.php
@@ -1,10 +1,25 @@
prepare("INSERT INTO gwtitles (titlename, titletype, titlemaxrank, autofilled) VALUES (?, ?, ?, ?)");
- $stmtins->bind_param("siii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank'], $_POST['autofill']);
+ if (!isset($_POST['gwamm'])) {
+ $_POST['gwamm'] == 0;
+ } else {
+ // $ggid = Get Gwamm ID
+ $ggid = $con->prepare("SELECT titlenameid FROM gwtitles WHERE gwamm = 1");
+ $ggid->execute();
+ $ggid->bind_result($gwammid);
+ $ggid->fetch();
+ $ggid->close();
+ // $rg = Remove GWAMM
+ $rg = $con->prepare("UPDATE gwtitles SET gwamm = 0 WHERE titlenameid = ?");
+ $rg->bind_param("i", $gwammid);
+ $rg->execute();
+ $rg->close();
+ }
+ $stmtins = $con->prepare("INSERT INTO gwtitles (titlename, titletype, titlemaxrank, autofilled, gwamm) VALUES (?, ?, ?, ?, ?)");
+ $stmtins->bind_param("siiii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank'], $_POST['autofill'], $_POST['gwamm']);
$stmtins->execute();
$stmtins->close();
echo 'New title added! ';
diff --git a/includes/title-update.php b/includes/title-update.php
index d46ce3c..7158458 100644
--- a/includes/title-update.php
+++ b/includes/title-update.php
@@ -19,11 +19,26 @@ if (isset($_SESSION['userid'])) {
}
} else {
if (!isset($_POST['autofill'])) {
- $_POST['autofill'] = "0";
+ $_POST['autofill'] == 0;
+ }
+ if (!isset($_POST['gwamm'])) {
+ $_POST['gwamm'] == 0;
+ } else {
+ // $ggid = Get Gwamm ID from current GWAMM holder
+ $ggid = $con->prepare("SELECT titlenameid FROM gwtitles WHERE gwamm = 1");
+ $ggid->execute();
+ $ggid->bind_result($gwammid);
+ $ggid->fetch();
+ $ggid->close();
+ // $rg = Remove GWAMM
+ $rg = $con->prepare("UPDATE gwtitles SET gwamm = 0 WHERE titlenameid = ?");
+ $rg->bind_param("i", $gwammid);
+ $rg->execute();
+ $rg->close();
}
// this section updates the title name
- $stmtupd = $con->prepare("UPDATE gwtitles SET titlename = ?, titletype = ?, titlemaxrank = ?, autofilled = ? WHERE titlenameid = ?");
- $stmtupd->bind_param("siiii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank'], $_POST['autofill'], $_POST['titlenameid']);
+ $stmtupd = $con->prepare("UPDATE gwtitles SET titlename = ?, titletype = ?, titlemaxrank = ?, autofilled = ?, gwamm = ? WHERE titlenameid = ?");
+ $stmtupd->bind_param("siiiii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank'], $_POST['autofill'], $_POST['gwamm'], $_POST['titlenameid']);
$stmtupd->execute();
$stmtupd->close();
echo 'Title updated, redirecting!';