Bladeren bron

adding code to delete characters

pull/16/head
mauirixxx 7 jaren geleden
bovenliggende
commit
373f9a348c
1 gewijzigde bestanden met toevoegingen van 19 en 13 verwijderingen
  1. +19
    -13
      addaccounts.php

+ 19
- 13
addaccounts.php Bestand weergeven

@@ -12,10 +12,21 @@ if (!empty($_POST['accemail'])) {
exit(); exit();
} }


if (!empty($_POST['delchar'])) {
echo 'removing selected character(s) from selected account<br />';
$delchar = $con->prepare("DELETE FROM gwchars WHERE charid = ? AND accid = ? AND userid = ?");
$delchar->bind_param("iii", $_POST['charid'], $_POST['accid'], $_SESSION['userid']);
$delchar->execute();
$delchar->close();
echo 'Need to figure out code to delete stats related to this character still!<br />';
//header ("Refresh:1; url=addacounts.php");
//exit();
}

echo '<form action="addaccounts.php" method="post"><table>'; echo '<form action="addaccounts.php" method="post"><table>';
echo '<caption>Add a new Guild Wars account e-mail</caption>';
echo '<tr><td><input type="text" name="accemail" size="35" autofocus required></td></tr>';
echo '</table><input type="submit" value="Add account"></form><br /><br />';
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 '<table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current Guild Wars accounts</caption>'; echo '<table border="1"><caption style="white-space: nowrap; overflow: hidden;">Current Guild Wars accounts</caption>';
echo '<tr><th>Account name</th></tr>'; echo '<tr><th>Account name</th></tr>';
@@ -35,27 +46,22 @@ while ($row = $result->fetch_assoc()) {
} }
$acclist->close(); $acclist->close();
echo '</table><br />'; echo '</table><br />';
echo '<table border ="1"><caption style="white-space: nowrap; overflow: hidden;">Available characters</caption>';

echo '<form action="addaccount.php" method="post"><table border="1"><caption style="white-space: nowrap; overflow: hidden;">Available characters</caption>';
echo '<tr><td>charid</td><td>charname</td><td>Delete?</td></tr>';
$lc = $con->prepare("SELECT charid, charname FROM gwchars WHERE accid = ?"); $lc = $con->prepare("SELECT charid, charname FROM gwchars WHERE accid = ?");
$lc->bind_param("i", $_SESSION['prefaccid']); $lc->bind_param("i", $_SESSION['prefaccid']);
$lc->execute(); $lc->execute();
$res2 = $lc->get_result(); $res2 = $lc->get_result();

while ($row2 = $res2->fetch_assoc()) { while ($row2 = $res2->fetch_assoc()) {
echo '<tr><td>';
echo '<tr><td>' . $row2['charid'] . '</td><td>';
if ($row2['charid'] == $_SESSION['prefcharid']) { if ($row2['charid'] == $_SESSION['prefcharid']) {
echo '<b>' . $row2['charname'] . '</b>'; echo '<b>' . $row2['charname'] . '</b>';
} else { } else {
echo $row2['charname']; echo $row2['charname'];
} }
echo '</td></tr>';
echo '</td><td><input type="checkbox" name="delchar" value="yes"></td></tr>';
} }

/*} else {
echo '<tr><td>' . count($row2) . ' results!</td></tr>';
echo '<tr><td>No characters found!</td></tr>';
}*/

echo '</table>'; echo '</table>';
echo '<br />Return to your <a href="index.php" class="navlink">user</a> page'; echo '<br />Return to your <a href="index.php" class="navlink">user</a> page';
include_once ('footer.php'); include_once ('footer.php');

Laden…
Annuleren
Opslaan