| @@ -7,6 +7,7 @@ if (isset($_SESSION['userid'])){ | |||||
| echo '<center>Welcome to the admin area!<br /><br />'; | echo '<center>Welcome to the admin area!<br /><br />'; | ||||
| echo 'Title creator / editor <a href="titlemanager.php" class="navlink">here</a> (work in progress)<br /><br />'; | echo 'Title creator / editor <a href="titlemanager.php" class="navlink">here</a> (work in progress)<br /><br />'; | ||||
| echo 'User editor <a href="" class="navlink">here</a> (not working yet)<br /><br />'; | echo 'User editor <a href="" class="navlink">here</a> (not working yet)<br /><br />'; | ||||
| echo 'testing gwamm and autofilled titles theories <a href="autofilled.php" class="navlink">Legendary GWAMM</a><br /><br />'; | |||||
| include_once ('includes/session-dump.php'); | include_once ('includes/session-dump.php'); | ||||
| } | } | ||||
| include_once ('footer.php'); | include_once ('footer.php'); | ||||
| @@ -1,8 +1,8 @@ | |||||
| <?php | <?php | ||||
| if (isset($_SESSION['userid'])) { | if (isset($_SESSION['userid'])) { | ||||
| echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Name</th><th>Title Type</th><th>Max Rank</th><th>Auto filled?</th></tr>'; | |||||
| echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Name</th><th>Title Type</th><th>Max Rank</th><th>Auto filled?</th><td>GWAMM?</td></tr>'; | |||||
| echo '<tr><td><input type="text" name="titlename" placeholder="Friend of the Kurzicks" required autofocus></td><td style="text-align:left"><input type="radio" name="titletype" value="0" checked> Account<br /><input type="radio" name="titletype" value="1">Character</td>'; | echo '<tr><td><input type="text" name="titlename" placeholder="Friend of the Kurzicks" required autofocus></td><td style="text-align:left"><input type="radio" name="titletype" value="0" checked> Account<br /><input type="radio" name="titletype" value="1">Character</td>'; | ||||
| echo '<td><input type="number" name="titlemaxrank" min="0" max="15"></td><td><input type="checkbox" name="autofill" value="1"></td></tr>'; | |||||
| echo '<td><input type="number" name="titlemaxrank" min="0" max="15"></td><td><input type="checkbox" name="autofill" value="1"></td><td><input type="chckbox" name="gwamm" value="1"></td></tr>'; | |||||
| echo '</table><br /><input type="hidden" name="title" value="titlesubmit"><input type="submit" value="Add new title ..."></form>'; | echo '</table><br /><input type="hidden" name="title" value="titlesubmit"><input type="submit" value="Add new title ..."></form>'; | ||||
| } | } | ||||
| ?> | ?> | ||||
| @@ -1,7 +1,7 @@ | |||||
| <?php | <?php | ||||
| if (isset($_SESSION['userid'])) { | if (isset($_SESSION['userid'])) { | ||||
| echo '<form action="titlemanager.php" method="post">'; | echo '<form action="titlemanager.php" method="post">'; | ||||
| echo '<table border="1"><tr><th>titlenameid</th><th>titlename</th><th>titletype</th><th>titlemaxrank</th><th>autofilled</th></tr>'; | |||||
| echo '<table border="1"><tr><th>titlenameid</th><th>titlename</th><th>titletype</th><th>titlemaxrank</th><th>autofilled</th><th>gwamm</th></tr>'; | |||||
| $stmtview = $con->prepare("SELECT * FROM gwtitles WHERE titlenameid = ?"); | $stmtview = $con->prepare("SELECT * FROM gwtitles WHERE titlenameid = ?"); | ||||
| $stmtview->bind_param("i", $_POST['tid']); | $stmtview->bind_param("i", $_POST['tid']); | ||||
| $stmtview->execute(); | $stmtview->execute(); | ||||
| @@ -11,7 +11,8 @@ if (isset($_SESSION['userid'])) { | |||||
| $tname = $row['titlename']; | $tname = $row['titlename']; | ||||
| $ttype = $row['titletype']; | $ttype = $row['titletype']; | ||||
| $tmr = $row['titlemaxrank']; | $tmr = $row['titlemaxrank']; | ||||
| $taf = $row['autofilled']; | |||||
| $taf = $row['autofilled']; | |||||
| $tg = $row['gwamm']; // $tg = Title GWAMM tracking | |||||
| echo '<tr><td><input readonly size="3" name="titlenameid" value="' . $tid . '"></td><td><input size="40" type="text" name="titlename" value="' . $tname . '"></td><td style="text-align:left">'; | echo '<tr><td><input readonly size="3" name="titlenameid" value="' . $tid . '"></td><td><input size="40" type="text" name="titlename" value="' . $tname . '"></td><td style="text-align:left">'; | ||||
| echo '<input type="radio" name="titletype" '; | echo '<input type="radio" name="titletype" '; | ||||
| if ($ttype == 0) { | if ($ttype == 0) { | ||||
| @@ -23,14 +24,26 @@ if (isset($_SESSION['userid'])) { | |||||
| echo 'checked '; | echo 'checked '; | ||||
| } | } | ||||
| echo 'value="1">Character</td><td><input type="number" name="titlemaxrank" min="1" max="15" value="' . $tmr . '"></td><td>'; | echo 'value="1">Character</td><td><input type="number" name="titlemaxrank" min="1" max="15" value="' . $tmr . '"></td><td>'; | ||||
| echo '<input type="checkbox" name="autofill" value="' . $taf . '" '; | |||||
| echo '<input type="checkbox" name="autofill" value="1" '; | |||||
| if ($taf == 1) { | if ($taf == 1) { | ||||
| echo 'checked'; | echo 'checked'; | ||||
| } | } | ||||
| echo '></td><td><input type="checkbox" name="gwamm" value="1" '; | |||||
| if ($tg == 1) { | |||||
| echo 'checked'; | |||||
| } | |||||
| echo '></td></tr>'; | echo '></td></tr>'; | ||||
| } | } | ||||
| $stmtview->close(); | $stmtview->close(); | ||||
| echo '</table><table><tr><th>Delete title?</th></tr><tr><td><input type="checkbox" name="deltitle" value="yes"></td></tr></table><br /><br />'; | |||||
| echo '</table><table><tr><td>The current GWAMM title is: <b>'; | |||||
| // $ggt = Get GWAMM Title | |||||
| $ggt = $con->prepare("SELECT titlename FROM gwtitles WHERE gwamm = '1'"); | |||||
| $ggt->execute(); | |||||
| $ggt->bind_result($gwamm); | |||||
| $ggt->fetch(); | |||||
| $ggt->close(); | |||||
| echo $gwamm . '</b></td></tr>'; | |||||
| echo '<tr><th>Delete title?</th></tr><tr><td><input type="checkbox" name="deltitle" value="yes"></td></tr></table><br /><br />'; | |||||
| echo '<input type="hidden" name="title" value="updatetitle"><input type="submit" value="Modify title ..."></form><br />'; | echo '<input type="hidden" name="title" value="updatetitle"><input type="submit" value="Modify title ..."></form><br />'; | ||||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | ||||
| } | } | ||||
| @@ -1,10 +1,25 @@ | |||||
| <?php | <?php | ||||
| if (isset($_SESSION['userid'])) { | if (isset($_SESSION['userid'])) { | ||||
| if (!isset($_POST['autofill'])) { | if (!isset($_POST['autofill'])) { | ||||
| $_POST['autofill'] = "0"; | |||||
| $_POST['autofill'] == 0; | |||||
| } | } | ||||
| $stmtins = $con->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->execute(); | ||||
| $stmtins->close(); | $stmtins->close(); | ||||
| echo 'New title added!<br /><br />'; | echo 'New title added!<br /><br />'; | ||||
| @@ -19,11 +19,26 @@ if (isset($_SESSION['userid'])) { | |||||
| } | } | ||||
| } else { | } else { | ||||
| if (!isset($_POST['autofill'])) { | 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 | // 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->execute(); | ||||
| $stmtupd->close(); | $stmtupd->close(); | ||||
| echo 'Title updated, redirecting!'; | echo 'Title updated, redirecting!'; | ||||