| @@ -1,45 +1,35 @@ | |||
| <?php | |||
| $pagetitle = "Add a Guild Wars account to track"; | |||
| include_once ('header.php'); | |||
| if (isset($_SESSION['userid'])) { | |||
| //include_once ('includes/session-debug.php'); | |||
| //include_once ('includes/session-dump.php'); | |||
| if (isset($_SESSION['userid'])) { | |||
| if (!empty($_POST['prefcharid'])) { | |||
| //this section contains code to the users preferred character | |||
| include_once ('includes/set-prefchar.php'); | |||
| } | |||
| if (!empty($_POST['prefaccid'])) { | |||
| //this section contains code to set the users preferred game account | |||
| include_once ('includes/set-prefacc.php'); | |||
| } | |||
| if (!empty($_POST['accemail'])) { | |||
| // this section contains the code to add a new game account to track | |||
| include_once ('includes/addaccount-submit.php'); | |||
| } | |||
| if (!empty($_POST['delaccid'])) { | |||
| // this section containts the code to delete an account | |||
| include_once ('includes/del-account.php'); | |||
| } | |||
| if (!empty($_POST['delcharid'])) { | |||
| // this section contains code to delete the selected characters | |||
| include_once ('includes/del-character.php'); | |||
| } | |||
| if (!empty($_POST['newcharname'])) { | |||
| // this section contains code to insert a new character into the database | |||
| include_once ('includes/addcharacters-submit.php'); | |||
| } | |||
| echo '<form action="addaccounts.php" method="post"><table>'; | |||
| echo '<caption>Add a new Guild Wars account e-mail or alias</caption>'; | |||
| echo '<tr><td><input type="text" name="accemail" size="35" required></td><td><input type="submit" value="Add account"></td></tr>'; | |||
| echo '</table></form><br />'; | |||
| echo '<form action="addaccounts.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current Guild Wars accounts</caption>'; | |||
| echo '<tr><th>Account name</th><th>Preferred?</th><th>Delete ?</th></tr>'; | |||
| $acclist = $con->prepare("SELECT accid, accemail FROM gwaccounts WHERE userid = ?"); | |||
| @@ -57,7 +47,6 @@ if (isset($_SESSION['userid'])) { | |||
| } | |||
| $acclist->close(); | |||
| echo '</form></table><input type="submit" value="Modify selected accounts"></form><br />'; | |||
| // add characters here | |||
| echo '<form action="addaccounts.php" method="post"><table>'; | |||
| echo '<caption style="white-space: nowrap; overflow: hidden;">Add character to account: ' . $_SESSION['prefaccname'] . '</caption>'; | |||
| @@ -72,7 +61,6 @@ if (isset($_SESSION['userid'])) { | |||
| } | |||
| echo '</td></tr>'; | |||
| echo '<tr><td colspan="3"><input type="submit" value="Add character"></td></tr></table></form><br />'; | |||
| echo '<form action="addaccounts.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Available characters</caption>'; | |||
| echo '<tr><td>charid</td><td>accid</td><td>charname</td><td>Preferred</td><td>Delete?</td></tr>'; | |||
| $lc = $con->prepare("SELECT charid, accid, charname, profid, profcolor FROM gwchars WHERE accid = ?"); | |||
| @@ -0,0 +1,13 @@ | |||
| <?php | |||
| if (isset($_SESSION['userid'])) { | |||
| // $cls = Character List Select | |||
| $cls = $con->prepare("SELECT charid, charname, profid FROM gwchars WHERE accid = ? AND userid = ? ORDER BY charname"); | |||
| $cls->bind_param("ii", $_SESSION['prefaccid'], $_SESSION['userid']); | |||
| $cls->execute(); | |||
| $clsres = $cls->get_result(); | |||
| while ($clsrow = $clsres->fetch_assoc()) { | |||
| echo '<option class="profession-' . $clsrow['profid'] . '" value="' . $clsrow['charid'] . '">' . $clsrow['charname'] . '</option>'; | |||
| } | |||
| $cls->close(); | |||
| } | |||
| ?> | |||
| @@ -26,10 +26,19 @@ if (!$userid){ | |||
| echo 'GWST'; | |||
| } | |||
| echo '</title></head><body><center>'; | |||
| if (!empty($_POST['prefcharid'])) { | |||
| //this section contains code to the users preferred character | |||
| include_once ('includes/set-prefchar.php'); | |||
| } | |||
| echo '<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">'; | |||
| echo '(<a href="index.php" class="navlink">Home</a>) (<a href="preferences.php" class="navlink">Options</a>) '; | |||
| if ($_SESSION['admin'] == 1){ | |||
| echo'(<a href="adminlanding.php" class="navlink">Administration</a>) '; | |||
| } | |||
| echo '(<a href="logout.php?action=logout" class="navlink">Logout ' . $_SESSION['username'] . '</a>)<hr><br / >'; | |||
| echo '(<a href="logout.php?action=logout" class="navlink">Logout ' . $_SESSION['username'] . '</a>) (<select name="prefcharid" onchange="this.form.submit()">'; | |||
| echo '<option class="profession-' . $_SESSION['charprofid'] . '" value="' . $_SESSION['prefcharid'] . '">' . $_SESSION['prefcharname'] . '</option>'; | |||
| echo '<option value="nopref">No default selected</option>'; | |||
| include_once ('header-list-chars.php'); | |||
| echo '</select>)<noscript><input type="submit" value="Select Character"></noscript></form><hr><br / >'; | |||
| } | |||
| ?> | |||
| @@ -1,6 +1,5 @@ | |||
| <?php | |||
| if (isset($_SESSION['userid'])) { | |||
| //echo 'removing selected character(s) from selected account<br />'; | |||
| if ($delchar = $con->prepare("DELETE FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?")) { | |||
| $delchar->bind_param("iii", $delcharid, $delaccid, $_SESSION['userid']); | |||
| for ($i = 0; $i < count($_POST['delcharid']); $i++) { | |||
| @@ -10,12 +9,14 @@ if (isset($_SESSION['userid'])) { | |||
| } | |||
| $delchar->close(); | |||
| } | |||
| // need to delete associate character stats as well. TODO | |||
| $nap = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?"); | |||
| $nap->bind_param("i", $_SESSION['userid']); | |||
| $nap->execute(); | |||
| $nap->close(); | |||
| $_SESSION['prefcharid'] = "0"; | |||
| $_SESSION['prefcharname'] = "No default selected"; | |||
| $_SESSION['charprofid'] = "0"; | |||
| echo 'Character(s) deleted - no preferred character selected.<br /><br />'; | |||
| } | |||
| ?> | |||
| @@ -1,7 +1,4 @@ | |||
| <?php | |||
| //include_once ('includes/session-debug.php'); | |||
| //include_once ('includes/session-dump.php'); | |||
| // remove the above 2 lines | |||
| if (isset($_SESSION['userid'])) { | |||
| echo '<table border="1"><caption>Account wide stats</caption>'; | |||
| echo '<tr><th>Title</th><th>Title Rank</th><th>Title Points</th><th>Current Rank</th><th>Points Remaining</th><th>Max Title %</th><th>Next Rank</th></tr>'; | |||
| @@ -1,6 +1,7 @@ | |||
| <?php | |||
| if (isset($_SESSION['userid'])) { | |||
| if ($_POST['prefaccid'] == "nopref") { | |||
| // $nap = No AccountID Preferrence | |||
| $nap = $con->prepare("UPDATE userinfo SET prefaccid = 0, prefaccname = 'No default selected' WHERE userid = ?"); | |||
| $nap->bind_param("i", $_SESSION['userid']); | |||
| $nap->execute(); | |||
| @@ -9,6 +10,7 @@ if (isset($_SESSION['userid'])) { | |||
| $_SESSION['prefaccname'] = "No default selected"; | |||
| echo 'Account preference update - no preferred account selected.<br />'; | |||
| } else { | |||
| // $sap = Select AccountID Preferrence | |||
| $sap = $con->prepare("SELECT accid, accemail FROM gwaccounts WHERE accid = ? AND userid = ?"); | |||
| $sap->bind_param("ii", $_POST['prefaccid'], $_SESSION['userid']); | |||
| $sap->execute(); | |||
| @@ -21,13 +23,15 @@ if (isset($_SESSION['userid'])) { | |||
| $_SESSION['prefaccid'] = $row['accid']; | |||
| $_SESSION['prefaccname'] = $row['accemail']; | |||
| } | |||
| $ncp = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?"); | |||
| $ncp->bind_param("i", $_SESSION['userid']); | |||
| $ncp->execute(); | |||
| $ncp->close(); | |||
| $_SESSION['prefcharid'] = "0"; | |||
| $_SESSION['prefcharname'] = "No default selected"; | |||
| echo 'Guild Wars preferred account updated! <br />'; | |||
| $sap->close(); | |||
| } | |||
| $ncp = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?"); | |||
| $ncp->bind_param("i", $_SESSION['userid']); | |||
| $ncp->execute(); | |||
| $ncp->close(); | |||
| $_SESSION['prefcharid'] = "0"; | |||
| $_SESSION['prefcharname'] = "No default selected"; | |||
| $_SESSION['charprofid'] = "0"; | |||
| echo 'Guild Wars preferred account updated! <br />'; | |||
| } | |||
| ?> | |||
| @@ -1,15 +1,17 @@ | |||
| <?php | |||
| if (isset($_SESSION['userid'])) { | |||
| if ($_POST['prefcharid'] == "nopref") { | |||
| // $ncp = No CharID Preferrence | |||
| $ncp = $con->prepare("UPDATE userinfo SET prefcharid = 0, prefcharname = 'No default selected' WHERE userid = ?"); | |||
| $ncp->bind_param("i", $_SESSION['userid']); | |||
| $ncp->execute(); | |||
| $ncp->close(); | |||
| $_SESSION['prefcharid'] = "0"; | |||
| $_SESSION['prefcharname'] = "No default selected"; | |||
| echo 'Character preference update - no preferred character selected.<br />'; | |||
| $_SESSION['charprofid'] = "0"; | |||
| } else { | |||
| $scp = $con->prepare("SELECT charid, charname FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?"); | |||
| // $scp = Selected CharID Preferrence | |||
| $scp = $con->prepare("SELECT charid, charname, profid FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?"); | |||
| $scp->bind_param("iii", $_POST['prefcharid'], $_SESSION['prefaccid'], $_SESSION['userid']); | |||
| $scp->execute(); | |||
| $result = $scp->get_result(); | |||
| @@ -20,8 +22,8 @@ if (isset($_SESSION['userid'])) { | |||
| $uap->close(); | |||
| $_SESSION['prefcharid'] = $row['charid']; | |||
| $_SESSION['prefcharname'] = $row['charname']; | |||
| $_SESSION['charprofid'] = $row['profid']; | |||
| } | |||
| echo 'Guild Wars preferred character updated! <br />'; | |||
| } | |||
| } | |||
| ?> | |||
| @@ -1,6 +1,8 @@ | |||
| <?php | |||
| echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Name</th><th>Title Type</th><th>Max Rank</th></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 '<td><input type="number" name="titlemaxrank" min="0" max="15"></td></tr>'; | |||
| echo '</table><br /><input type="hidden" name="title" value="titlesubmit"><input type="submit" value="Add new title ..."></form>'; | |||
| 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></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 '<td><input type="number" name="titlemaxrank" min="0" max="15"></td></tr>'; | |||
| echo '</table><br /><input type="hidden" name="title" value="titlesubmit"><input type="submit" value="Add new title ..."></form>'; | |||
| } | |||
| ?> | |||
| @@ -1,29 +1,31 @@ | |||
| <?php | |||
| echo '<form action="titlemanager.php" method="post">'; | |||
| echo '<table border="1"><tr><th>titlenameid</th><th>titlename</th><th>titletype</th><th>titlemaxrank</th></tr>'; | |||
| $stmtview = $con->prepare("SELECT * FROM gwtitles WHERE titlenameid = ?"); | |||
| $stmtview->bind_param("i", $_POST['tid']); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $tid = $row['titlenameid']; | |||
| $tname = $row['titlename']; | |||
| $ttype = $row['titletype']; | |||
| $tmr = $row['titlemaxrank']; | |||
| 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" '; | |||
| if ($ttype == 0) { | |||
| echo 'checked '; | |||
| if (isset($_SESSION['userid'])) { | |||
| echo '<form action="titlemanager.php" method="post">'; | |||
| echo '<table border="1"><tr><th>titlenameid</th><th>titlename</th><th>titletype</th><th>titlemaxrank</th></tr>'; | |||
| $stmtview = $con->prepare("SELECT * FROM gwtitles WHERE titlenameid = ?"); | |||
| $stmtview->bind_param("i", $_POST['tid']); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $tid = $row['titlenameid']; | |||
| $tname = $row['titlename']; | |||
| $ttype = $row['titletype']; | |||
| $tmr = $row['titlemaxrank']; | |||
| 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" '; | |||
| if ($ttype == 0) { | |||
| echo 'checked '; | |||
| } | |||
| echo 'value="0">Account<br />'; | |||
| echo '<input type="radio" name="titletype" '; | |||
| if ($ttype == 1) { | |||
| echo 'checked '; | |||
| } | |||
| echo 'value="1">Character</td><td><input type="number" name="titlemaxrank" min="1" max="15" value="' . $tmr . '"></td></tr>'; | |||
| } | |||
| echo 'value="0">Account<br />'; | |||
| echo '<input type="radio" name="titletype" '; | |||
| if ($ttype == 1) { | |||
| echo 'checked '; | |||
| } | |||
| echo 'value="1">Character</td><td><input type="number" name="titlemaxrank" min="1" max="15" value="' . $tmr . '"></td></tr>'; | |||
| $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 '<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>'; | |||
| } | |||
| $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 '<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>'; | |||
| ?> | |||
| @@ -1,12 +1,14 @@ | |||
| <?php | |||
| $stmtview = $con->prepare("SELECT * FROM gwtitles ORDER BY titlename"); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $tid = $row['titlenameid']; | |||
| $tname = $row['titlename']; | |||
| $tnr = $row['titlemaxrank']; | |||
| echo '<option value="' . $tid . '">' . $tname . ' (' . $tnr . ')</option>'; | |||
| if (isset($_SESSION['userid'])) { | |||
| $stmtview = $con->prepare("SELECT * FROM gwtitles ORDER BY titlename"); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $tid = $row['titlenameid']; | |||
| $tname = $row['titlename']; | |||
| $tnr = $row['titlemaxrank']; | |||
| echo '<option value="' . $tid . '">' . $tname . ' (' . $tnr . ')</option>'; | |||
| } | |||
| $stmtview->close(); | |||
| } | |||
| $stmtview->close(); | |||
| ?> | |||
| @@ -1,20 +1,22 @@ | |||
| <?php | |||
| $stmtins = $con->prepare("INSERT INTO gwtitles (titlename, titletype, titlemaxrank) VALUES (?, ?, ?)"); | |||
| $stmtins->bind_param("sii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank']); | |||
| $stmtins->execute(); | |||
| $stmtins->close(); | |||
| echo 'New title added!<br /><br />'; | |||
| $stmtview = $con->prepare("SELECT * FROM gwtitles ORDER BY titlenameid DESC LIMIT 1"); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $tid = $row['titlenameid']; | |||
| $tname = $row['titlename']; | |||
| $ttype = $row['titletype']; | |||
| $tmr = $row['titlemaxrank']; | |||
| echo '<table border="1"><tr><th>titleid</th><th>titlename</th><th>titletype</th><th>titlemaxrank</th></tr>'; | |||
| echo '<tr><td>' . $tid . '</td><td>' . $tname . '</td><td>' . $ttype . '</td><td>' . $tmr . '</td></tr></table><br />'; | |||
| if (isset($_SESSION['userid'])) { | |||
| $stmtins = $con->prepare("INSERT INTO gwtitles (titlename, titletype, titlemaxrank) VALUES (?, ?, ?)"); | |||
| $stmtins->bind_param("sii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank']); | |||
| $stmtins->execute(); | |||
| $stmtins->close(); | |||
| echo 'New title added!<br /><br />'; | |||
| $stmtview = $con->prepare("SELECT * FROM gwtitles ORDER BY titlenameid DESC LIMIT 1"); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $tid = $row['titlenameid']; | |||
| $tname = $row['titlename']; | |||
| $ttype = $row['titletype']; | |||
| $tmr = $row['titlemaxrank']; | |||
| echo '<table border="1"><tr><th>titleid</th><th>titlename</th><th>titletype</th><th>titlemaxrank</th></tr>'; | |||
| echo '<tr><td>' . $tid . '</td><td>' . $tname . '</td><td>' . $ttype . '</td><td>' . $tmr . '</td></tr></table><br />'; | |||
| } | |||
| $stmtview->close(); | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| } | |||
| $stmtview->close(); | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| ?> | |||
| @@ -1,28 +1,30 @@ | |||
| <?php | |||
| if (isset($_POST['deltitle'])) { | |||
| if ($_POST['deltitle'] == "yes") { | |||
| // this title makes you verify that you want to delete this title | |||
| echo '<form action="titlemanager.php" method="post">Please check the box to verify you want to delete: <b>' . $_POST['titlename'] . '</b> <input type="checkbox" name="deltitle" value="iamsure">'; | |||
| echo '<input type="hidden" name="titlenameid" value="' . $_POST['titlenameid'] . '"><input type="hidden" name="title" value="updatetitle"><input type="submit" value="Delete title"></form><br /><br />'; | |||
| } else if ($_POST['deltitle'] == "iamsure") { | |||
| // this section actually deletes the title | |||
| $stmtdel = $con->prepare("DELETE FROM gwtitles WHERE titlenameid = ?"); | |||
| $stmtdel->bind_param("i", $_POST['titlenameid']); | |||
| $stmtdel->execute(); | |||
| $stmtdelst = $con->prepare("DELETE FROM gwsubtitles WHERE titlenameid = ?"); | |||
| $stmtdelst->bind_param("i", $_POST['titlenameid']); | |||
| $stmtdelst->execute(); | |||
| $stmtdel->close(); | |||
| echo 'The title and associated title ranks have been deleted, redirecting!'; | |||
| if (isset($_SESSION['userid'])) { | |||
| if (isset($_POST['deltitle'])) { | |||
| if ($_POST['deltitle'] == "yes") { | |||
| // this title makes you verify that you want to delete this title | |||
| echo '<form action="titlemanager.php" method="post">Please check the box to verify you want to delete: <b>' . $_POST['titlename'] . '</b> <input type="checkbox" name="deltitle" value="iamsure">'; | |||
| echo '<input type="hidden" name="titlenameid" value="' . $_POST['titlenameid'] . '"><input type="hidden" name="title" value="updatetitle"><input type="submit" value="Delete title"></form><br /><br />'; | |||
| } else if ($_POST['deltitle'] == "iamsure") { | |||
| // this section actually deletes the title | |||
| $stmtdel = $con->prepare("DELETE FROM gwtitles WHERE titlenameid = ?"); | |||
| $stmtdel->bind_param("i", $_POST['titlenameid']); | |||
| $stmtdel->execute(); | |||
| $stmtdelst = $con->prepare("DELETE FROM gwsubtitles WHERE titlenameid = ?"); | |||
| $stmtdelst->bind_param("i", $_POST['titlenameid']); | |||
| $stmtdelst->execute(); | |||
| $stmtdel->close(); | |||
| echo 'The title and associated title ranks have been deleted, redirecting!'; | |||
| header ("Refresh:1; url=titlemanager.php"); | |||
| } | |||
| } else { | |||
| // this section updates the title name | |||
| $stmtupd = $con->prepare("UPDATE gwtitles SET titlename = ?, titletype = ?, titlemaxrank = ? WHERE titlenameid = ?"); | |||
| $stmtupd->bind_param("siii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank'], $_POST['titlenameid']); | |||
| $stmtupd->execute(); | |||
| $stmtupd->close(); | |||
| echo 'Title updated, redirecting!'; | |||
| header ("Refresh:1; url=titlemanager.php"); | |||
| } | |||
| } else { | |||
| // this section updates the title name | |||
| $stmtupd = $con->prepare("UPDATE gwtitles SET titlename = ?, titletype = ?, titlemaxrank = ? WHERE titlenameid = ?"); | |||
| $stmtupd->bind_param("siii", $_POST['titlename'], $_POST['titletype'], $_POST['titlemaxrank'], $_POST['titlenameid']); | |||
| $stmtupd->execute(); | |||
| $stmtupd->close(); | |||
| echo 'Title updated, redirecting!'; | |||
| header ("Refresh:1; url=titlemanager.php"); | |||
| } | |||
| ?> | |||
| @@ -1,67 +1,59 @@ | |||
| <?php | |||
| # 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 | |||
| unset($_SESSION['title']); | |||
| if (isset($_SESSION['tid'])) { | |||
| $_POST['tid'] = $_SESSION['tid']; | |||
| } | |||
| if (isset($_SESSION['tr'])) { | |||
| $tr = $_SESSION['tr'] + 1; | |||
| } else { | |||
| $trank = $con->prepare("SELECT MAX(strank) FROM gwsubtitles WHERE titlenameid = ?"); | |||
| $trank->bind_param("i", $_POST['tid']); | |||
| $trank->execute(); | |||
| $trank->store_result(); | |||
| $trank->bind_result($gwstmr); | |||
| while ($trank->fetch()) { | |||
| if (is_null($gwstmr)) { | |||
| $tr = 1; | |||
| if (isset($_SESSION['userid'])) { | |||
| unset($_SESSION['title']); | |||
| if (isset($_SESSION['tid'])) { | |||
| $_POST['tid'] = $_SESSION['tid']; | |||
| } | |||
| if (isset($_SESSION['tr'])) { | |||
| $tr = $_SESSION['tr'] + 1; | |||
| } else { | |||
| $trank = $con->prepare("SELECT MAX(strank) FROM gwsubtitles WHERE titlenameid = ?"); | |||
| $trank->bind_param("i", $_POST['tid']); | |||
| $trank->execute(); | |||
| $trank->store_result(); | |||
| $trank->bind_result($gwstmr); | |||
| while ($trank->fetch()) { | |||
| if (is_null($gwstmr)) { | |||
| $tr = 1; | |||
| } else { | |||
| $tr = $gwstmr + 1; | |||
| } | |||
| } | |||
| } | |||
| $stmtname = $con->prepare("SELECT titlename, titlemaxrank FROM gwtitles WHERE titlenameid = ?"); | |||
| $stmtname->bind_param("i", $_POST['tid']); | |||
| $stmtname->execute(); | |||
| $stmtname->store_result(); | |||
| $stmtname->bind_result($gwtn, $gwtmr); | |||
| while ($stmtname->fetch()) { | |||
| echo 'Adding rank to title <b>' . $gwtn . '</b><br />The maximum rank achievable in game is ' . $gwtmr . '<br />'; | |||
| if ($tr > $gwtmr) { | |||
| echo '<br />No more ranks can be added!<br /><br />'; | |||
| } else { | |||
| $tr = $gwstmr + 1; | |||
| echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Rank Name</th><th>Title Points</th><th>Rank Level</th></tr>'; | |||
| echo '<tr><td><input type="text" name="titlerankname" required autofocus></td><td><input type="number" name="titlepoints" required></td><td><input type="number" readonly name="titlerank" min="1" max="15" value="' . $tr . '"></tr>'; | |||
| echo '</table><br /><input type="hidden" name="title" value="titleranksubmit"><input type="hidden" name="titlenameid" value="' . $_POST['tid'] . '"><input type="submit" value="Add title rank ..."></form><br />'; | |||
| } | |||
| } | |||
| $stmtname->free_result(); | |||
| $stmtname->close(); | |||
| echo 'Here are the currently associated title ranks, starting with rank 1:<br />'; | |||
| echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>stnameid</th><th>titlenameid</th><th>stname</th><th>stpoints</th><th>strank</th><th>Edit</th></tr>'; | |||
| $stmtview = $con->prepare("SELECT * FROM gwsubtitles WHERE titlenameid = ? ORDER BY strank ASC"); | |||
| $stmtview->bind_param("i", $_POST['tid']); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $stnid = $row['stnameid']; | |||
| $tnid = $row['titlenameid']; | |||
| $stname = $row['stname']; | |||
| $stpoints = $row['stpoints']; | |||
| $strank = $row['strank']; | |||
| echo '<tr><td>' . $stnid . '<td>' . $tnid . '</td><td>' . $stname . '</td><td>' . number_format($stpoints) . '</td><td>' . $strank . '</td><td><input type="checkbox" name="editstitle[]" value="' . $stnid . '"></td></tr>'; | |||
| } | |||
| $stmtview->close(); | |||
| $_SESSION['tid'] = $_POST['tid']; | |||
| echo '</table><br /><input type="hidden" name="title" value="modsubtitle"><input type="submit" value="Edit selected titles"></form><br />If anything looks off, please fix it!<br /><br />'; | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| } | |||
| $stmtname = $con->prepare("SELECT titlename, titlemaxrank FROM gwtitles WHERE titlenameid = ?"); | |||
| $stmtname->bind_param("i", $_POST['tid']); | |||
| $stmtname->execute(); | |||
| $stmtname->store_result(); | |||
| $stmtname->bind_result($gwtn, $gwtmr); | |||
| while ($stmtname->fetch()) { | |||
| echo 'Adding rank to title <b>' . $gwtn . '</b><br />The maximum rank achievable in game is ' . $gwtmr . '<br />'; | |||
| if ($tr > $gwtmr) { | |||
| echo '<br />No more ranks can be added!<br /><br />'; | |||
| } else { | |||
| echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>Title Rank Name</th><th>Title Points</th><th>Rank Level</th></tr>'; | |||
| echo '<tr><td><input type="text" name="titlerankname" required autofocus></td><td><input type="number" name="titlepoints" required></td><td><input type="number" readonly name="titlerank" min="1" max="15" value="' . $tr . '"></tr>'; | |||
| echo '</table><br /><input type="hidden" name="title" value="titleranksubmit"><input type="hidden" name="titlenameid" value="' . $_POST['tid'] . '"><input type="submit" value="Add title rank ..."></form><br />'; | |||
| } | |||
| } | |||
| $stmtname->free_result(); | |||
| $stmtname->close(); | |||
| echo 'Here are the currently associated title ranks, starting with rank 1:<br />'; | |||
| echo '<form action="titlemanager.php" method="post"><table border="1"><tr><th>stnameid</th><th>titlenameid</th><th>stname</th><th>stpoints</th><th>strank</th><th>Edit</th></tr>'; | |||
| $stmtview = $con->prepare("SELECT * FROM gwsubtitles WHERE titlenameid = ? ORDER BY strank ASC"); | |||
| $stmtview->bind_param("i", $_POST['tid']); | |||
| $stmtview->execute(); | |||
| $result = $stmtview->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $stnid = $row['stnameid']; | |||
| $tnid = $row['titlenameid']; | |||
| $stname = $row['stname']; | |||
| $stpoints = $row['stpoints']; | |||
| $strank = $row['strank']; | |||
| echo '<tr><td>' . $stnid . '<td>' . $tnid . '</td><td>' . $stname . '</td><td>' . number_format($stpoints) . '</td><td>' . $strank . '</td><td><input type="checkbox" name="editstitle[]" value="' . $stnid . '"></td></tr>'; | |||
| } | |||
| $stmtview->close(); | |||
| $_SESSION['tid'] = $_POST['tid']; | |||
| echo '</table><br /><input type="hidden" name="title" value="modsubtitle"><input type="submit" value="Edit selected titles"></form><br />If anything looks off, please fix it!<br /><br />'; | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| ?> | |||
| @@ -1,30 +1,25 @@ | |||
| <?php | |||
| # 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['editstitle'])) { | |||
| echo '<form action="titlemanager.php" method="post"><table border="1"><caption>Deleting takes precedence over edits - edits will have to be remade after submission</caption>'; | |||
| echo '<tr><th>stnameid</th><th>titlenameid</th><th>stname</th><th>stpoints</th><th>strank</th><th>Delete?</th></tr>'; | |||
| $ph = implode(",", $_POST['editstitle']); | |||
| $sredit = $con->prepare("SELECT * FROM gwsubtitles WHERE titlenameid = ? AND stnameid IN ($ph)"); | |||
| $sredit->bind_param("i", $_SESSION['tid']); | |||
| $sredit->execute(); | |||
| $result = $sredit->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| echo '<tr><td><input type="text" readonly size="4" name="stnameid[]" value="' . $row['stnameid']. '"></td><td><input type="text" readonly size="4" name="titlenameid[]" value="' . $row['titlenameid'] . '"></td>'; | |||
| echo '<td><input type="text" name="stname[]" value="' . $row['stname'] . '"></td><td><input type="number" min="1" name="stpoints[]" value="' . $row['stpoints'] . '"></td>'; | |||
| echo '<td><input type="number" size="4" min="1" max="15" name="strank[]" value="' . $row['strank'] . '"></td><td><input type="checkbox" name="delsubtitle[]" value="' . $row['stnameid'] . '"></td></tr>'; | |||
| if (isset($_SESSION['userid'])) { | |||
| if (isset($_POST['editstitle'])) { | |||
| echo '<form action="titlemanager.php" method="post"><table border="1"><caption>Deleting takes precedence over edits - edits will have to be remade after submission</caption>'; | |||
| echo '<tr><th>stnameid</th><th>titlenameid</th><th>stname</th><th>stpoints</th><th>strank</th><th>Delete?</th></tr>'; | |||
| $ph = implode(",", $_POST['editstitle']); | |||
| $sredit = $con->prepare("SELECT * FROM gwsubtitles WHERE titlenameid = ? AND stnameid IN ($ph)"); | |||
| $sredit->bind_param("i", $_SESSION['tid']); | |||
| $sredit->execute(); | |||
| $result = $sredit->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| echo '<tr><td><input type="text" readonly size="4" name="stnameid[]" value="' . $row['stnameid']. '"></td><td><input type="text" readonly size="4" name="titlenameid[]" value="' . $row['titlenameid'] . '"></td>'; | |||
| echo '<td><input type="text" name="stname[]" value="' . $row['stname'] . '"></td><td><input type="number" min="1" name="stpoints[]" value="' . $row['stpoints'] . '"></td>'; | |||
| echo '<td><input type="number" size="4" min="1" max="15" name="strank[]" value="' . $row['strank'] . '"></td><td><input type="checkbox" name="delsubtitle[]" value="' . $row['stnameid'] . '"></td></tr>'; | |||
| } | |||
| $sredit->close(); | |||
| echo '</table><br /><input type="hidden" name="title" value="updatesubtitle"><input type="submit" value="Modify title rank(s)"></form>'; | |||
| echo '<br /><br />'; | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| } else { | |||
| echo 'No title ranks selected! Please press the back button on your browser to return to the previous page.<br /><br />'; | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| } | |||
| $sredit->close(); | |||
| echo '</table><br /><input type="hidden" name="title" value="updatesubtitle"><input type="submit" value="Modify title rank(s)"></form>'; | |||
| echo '<br /><br />'; | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| } else { | |||
| echo 'No title ranks selected! Please press the back button on your browser to return to the previous page.<br /><br />'; | |||
| echo 'Return to <a href="titlemanager.php" class="navlink">title manager</a>'; | |||
| } | |||
| ?> | |||
| @@ -1,11 +1,13 @@ | |||
| <?php | |||
| $stmtstins = $con->prepare("INSERT INTO gwsubtitles (titlenameid, stname, stpoints, strank) VALUES (?, ?, ?, ?)"); | |||
| $stmtstins->bind_param("isii", $_POST['titlenameid'], $_POST['titlerankname'], $_POST['titlepoints'], $_POST['titlerank']); | |||
| $stmtstins->execute(); | |||
| $stmtstins->close(); | |||
| $_SESSION['title'] = "repeat"; | |||
| $_SESSION['tid'] = $_POST['titlenameid']; | |||
| $_SESSION['tr'] = $_POST['titlerank']; | |||
| echo 'Title rank added, redirecting!'; | |||
| header ("Refresh:1; url=titlemanager.php"); | |||
| if (isset($_SESSION['userid'])) { | |||
| $stmtstins = $con->prepare("INSERT INTO gwsubtitles (titlenameid, stname, stpoints, strank) VALUES (?, ?, ?, ?)"); | |||
| $stmtstins->bind_param("isii", $_POST['titlenameid'], $_POST['titlerankname'], $_POST['titlepoints'], $_POST['titlerank']); | |||
| $stmtstins->execute(); | |||
| $stmtstins->close(); | |||
| $_SESSION['title'] = "repeat"; | |||
| $_SESSION['tid'] = $_POST['titlenameid']; | |||
| $_SESSION['tr'] = $_POST['titlerank']; | |||
| echo 'Title rank added, redirecting!'; | |||
| header ("Refresh:1; url=titlemanager.php"); | |||
| } | |||
| ?> | |||
| @@ -1,8 +1,10 @@ | |||
| <?php | |||
| include_once ('verifications.php'); | |||
| $updmail = $con->prepare("UPDATE userinfo SET usermail = ? WHERE userid = ?"); | |||
| $updmail->bind_param("si", $_POST['useremail'], $_SESSION['userid']); | |||
| $updmail->execute(); | |||
| $_SESSION['usermail'] = $_POST['useremail']; | |||
| echo 'E-mail address updated.<br />'; | |||
| if (isset($_SESSION['userid'])) { | |||
| include_once ('verifications.php'); | |||
| $updmail = $con->prepare("UPDATE userinfo SET usermail = ? WHERE userid = ?"); | |||
| $updmail->bind_param("si", $_POST['useremail'], $_SESSION['userid']); | |||
| $updmail->execute(); | |||
| $_SESSION['usermail'] = $_POST['useremail']; | |||
| echo 'E-mail address updated.<br />'; | |||
| } | |||
| ?> | |||
| @@ -1,21 +1,23 @@ | |||
| <?php | |||
| include_once ('verifications.php'); | |||
| $verifypass = $con->prepare("SELECT userpass FROM userinfo WHERE userid = ?"); | |||
| $verifypass->bind_param("i", $_SESSION['userid']); | |||
| $verifypass->execute(); | |||
| $result = $verifypass->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $vp = password_verify ($_POST['oldpass'],$row['userpass']); | |||
| if ($vp) { | |||
| $hp = password_hash($_POST['userpass1'], PASSWORD_DEFAULT); | |||
| echo 'Verified old password, updating to new password!<br />'; | |||
| $updpass = $con->prepare("UPDATE userinfo SET userpass = ? WHERE userid = ?"); | |||
| $updpass->bind_param("si", $hp, $_SESSION['userid']); | |||
| $updpass->execute(); | |||
| echo 'Password updated!<br />'; | |||
| $updpass->close(); | |||
| } else { | |||
| echo 'Old password doesn\'t match, password is NOT updated!<br />'; | |||
| if (isset($_SESSION['userid'])) { | |||
| include_once ('verifications.php'); | |||
| $verifypass = $con->prepare("SELECT userpass FROM userinfo WHERE userid = ?"); | |||
| $verifypass->bind_param("i", $_SESSION['userid']); | |||
| $verifypass->execute(); | |||
| $result = $verifypass->get_result(); | |||
| while ($row = $result->fetch_assoc()) { | |||
| $vp = password_verify ($_POST['oldpass'],$row['userpass']); | |||
| if ($vp) { | |||
| $hp = password_hash($_POST['userpass1'], PASSWORD_DEFAULT); | |||
| echo 'Verified old password, updating to new password!<br />'; | |||
| $updpass = $con->prepare("UPDATE userinfo SET userpass = ? WHERE userid = ?"); | |||
| $updpass->bind_param("si", $hp, $_SESSION['userid']); | |||
| $updpass->execute(); | |||
| echo 'Password updated!<br />'; | |||
| $updpass->close(); | |||
| } else { | |||
| echo 'Old password doesn\'t match, password is NOT updated!<br />'; | |||
| } | |||
| } | |||
| } | |||
| ?> | |||
| @@ -68,4 +68,16 @@ submitLink:focus { | |||
| } | |||
| .percentbar { background:#CCCCCC; border:1px solid #666666; height:10px; } | |||
| .percentbar div { background: #28B8C0; height: 10px; } | |||
| .percentbar div { background: #28B8C0; height: 10px; } | |||
| select *.profession-0 { background-color: #FFF; } | |||
| select *.profession-1 { background-color: #FF8; } | |||
| select *.profession-2 { background-color: #CF9; } | |||
| select *.profession-3 { background-color: #ACF; } | |||
| select *.profession-4 { background-color: #9FC; } | |||
| select *.profession-5 { background-color: #DAF; } | |||
| select *.profession-6 { background-color: #FBB; } | |||
| select *.profession-7 { background-color: #FCE; } | |||
| select *.profession-8 { background-color: #BFF; } | |||
| select *.profession-9 { background-color: #FC9; } | |||
| select *.profession-10 { background-color: #DDF; } | |||
| @@ -4,13 +4,13 @@ include_once ('header.php'); | |||
| if (isset($_SESSION['userid'])){ | |||
| if (isset($_SESSION['title'])) { | |||
| if ($_SESSION['title'] == "repeat") { | |||
| $_POST['title'] = "addsubtitle"; | |||
| unset($_SESSION['title']); | |||
| } else { | |||
| unset($_SESSION['tr']); | |||
| } | |||
| $_POST['title'] = "addsubtitle"; | |||
| unset($_SESSION['title']); | |||
| } else { | |||
| unset($_SESSION['tr']); | |||
| } | |||
| if ($_SESSION['admin'] == 1) { | |||
| } | |||
| if ($_SESSION['admin'] == 1) { | |||
| echo '<br />'; | |||
| if (isset($_POST['title'])) { | |||
| if ($_POST['title'] == "addtitle") { | |||